Documentation ¶
Index ¶
- Constants
- Variables
- func IsDelFlag(value []byte) bool
- func IsEmptyVersionedData(vd *ledger.VersionedData) bool
- func NewUTXOReaderFromInput(input []*protos.TxInput) contract.UtxoReader
- func ParseContractEvents(tx *lpb.Transaction) ([]*protos.ContractEvent, error)
- func XMReaderFromRWSet(rwset *contract.RWSet) ledger.XMReader
- type ContractIterator
- type MemXModel
- func (m *MemXModel) Get(bucket string, key []byte) (*ledger.VersionedData, error)
- func (m *MemXModel) NewIterator() ledger.XMIterator
- func (m *MemXModel) Put(bucket string, key []byte, value *ledger.VersionedData) error
- func (m *MemXModel) Select(bucket string, startKey []byte, endKey []byte) (ledger.XMIterator, error)
- type UTXOReader
- type UtxoReader
- type XMCache
- func (xc *XMCache) AddEvent(events ...*protos.ContractEvent)
- func (xc *XMCache) Del(bucket string, key []byte) error
- func (xc *XMCache) Flush() error
- func (xc *XMCache) Get(bucket string, key []byte) ([]byte, error)
- func (xc *XMCache) Put(bucket string, key []byte, value []byte) error
- func (xc *XMCache) RWSet() *contract.RWSet
- func (xc *XMCache) Select(bucket string, startKey []byte, endKey []byte) (contract.Iterator, error)
- func (xc *XMCache) Transfer(from, to string, amount *big.Int) error
- func (xc *XMCache) UTXORWSet() *contract.UTXORWSet
Constants ¶
const BucketSeperator = "/"
BucketSeperator separator between bucket and raw key
const DelFlag = "\x00"
DelFlag delete flag
const ( // TransientBucket is the name of bucket that only appears in tx output set // but does't persists in xmodel TransientBucket = "$transient" )
Variables ¶
var ( // ErrHasDel is returned when key was marked as del ErrHasDel = errors.New("Key has been mark as del") // ErrNotFound is returned when key is not found ErrNotFound = errors.New("Key not found") )
Functions ¶
func IsEmptyVersionedData ¶
func IsEmptyVersionedData(vd *ledger.VersionedData) bool
IsEmptyVersionedData check if VersionedData is empty
func NewUTXOReaderFromInput ¶
func NewUTXOReaderFromInput(input []*protos.TxInput) contract.UtxoReader
func ParseContractEvents ¶
func ParseContractEvents(tx *lpb.Transaction) ([]*protos.ContractEvent, error)
ParseContractEvents parse contract events from tx
Types ¶
type ContractIterator ¶
type ContractIterator struct {
ledger.XMIterator
}
ContractIterator 把contract.XMIterator转换成contract.Iterator
func (*ContractIterator) Value ¶
func (c *ContractIterator) Value() []byte
type MemXModel ¶
type MemXModel struct {
// contains filtered or unexported fields
}
func NewMemXModel ¶
func NewMemXModel() *MemXModel
func (*MemXModel) NewIterator ¶
func (m *MemXModel) NewIterator() ledger.XMIterator
type UTXOReader ¶
type UTXOReader struct {
// contains filtered or unexported fields
}
type UtxoReader ¶
type UtxoReader interface {
SelectUtxo(string, *big.Int, bool, bool) ([]*protos.TxInput, [][]byte, *big.Int, error)
}
UtxoReader manages utxos
type XMCache ¶
type XMCache struct {
// contains filtered or unexported fields
}
XMCache data structure for XModel Cache
func NewXModelCache ¶
func NewXModelCache(cfg *contract.SandboxConfig) *XMCache
NewXModelCache new an instance of XModel Cache
func (*XMCache) AddEvent ¶
func (xc *XMCache) AddEvent(events ...*protos.ContractEvent)
AddEvent add contract event to xmodel cache
func (*XMCache) Flush ¶
WriteTransientBucket write transient bucket data. transient bucket is a special bucket used to store some data generated during the execution of the contract, but will not be referenced by other txs.
func (*XMCache) Select ¶
Select select all kv from a bucket, can set key range, left closed, right opend When xc.isPenetrate equals true, three-way merge, When xc.isPenetrate equals false, two-way merge