代码拉取完成,页面将自动刷新
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package plain
import (
"github.com/hyperledger/fabric/common/ledger"
)
// A MemoryLedger is an in-memory ledger of transactions and unspent outputs.
// This implementation is only meant for testing.
type MemoryLedger struct {
entries map[string][]byte
}
// NewMemoryLedger creates a new MemoryLedger
func NewMemoryLedger() *MemoryLedger {
return &MemoryLedger{
entries: make(map[string][]byte),
}
}
// GetState gets the value for given namespace and Key. For a chaincode, the namespace corresponds to the chaincodeID
func (p *MemoryLedger) GetState(namespace string, key string) ([]byte, error) {
value := p.entries[key]
return value, nil
}
// SetState sets the given value for the given namespace and Key. For a chaincode, the namespace corresponds to the chaincodeID
func (p *MemoryLedger) SetState(namespace string, key string, value []byte) error {
p.entries[key] = value
return nil
}
// GetStateRangeScanIterator gets the values for a given namespace that lie in an interval determined by startKey and endKey.
// this is a mock function.
func (p *MemoryLedger) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (ledger.ResultsIterator, error) {
return nil, nil
}
// Done releases resources occupied by the MemoryLedger
func (p *MemoryLedger) Done() {
// No resources to be released for MemoryLedger
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。