Documentation ¶
Index ¶
- Constants
- func Equal(pd, vpd []*kledger.PureData) bool
- func GenWriteKeyWithPrefix(txOutputExt *protos.TxOutputExt) string
- func GetTxInputs(vds []*kledger.VersionedData) []*protos.TxInputExt
- func GetTxOutputs(pds []*kledger.PureData) []*protos.TxOutputExt
- func GetTxidFromVersion(version string) []byte
- func GetVersion(vd *kledger.VersionedData) string
- func GetVersionOfTxInput(txIn *protos.TxInputExt) string
- func IsEmptyVersionedData(vd *kledger.VersionedData) bool
- func MakeRawKey(bucket string, key []byte) []byte
- func MakeVersion(txid []byte, offset int32) string
- func MarshalMessages(msgs interface{}) ([]byte, error)
- func NewXMSnapshotReader(xMReader kledger.XMReader) *xMSnapshotReader
- func ParseContractUtxoInputs(tx *pb.Transaction) ([]*protos.TxInput, error)
- func UnmsarshalMessages(p []byte, x interface{}) error
- type XMIterator
- type XModel
- func (s *XModel) BucketCacheDelete(bucket, version string)
- func (s *XModel) CleanCache()
- func (s *XModel) CreateSnapshot(blkId []byte) (kledger.XMReader, error)
- func (s *XModel) CreateXMSnapshotReader(blkId []byte) (kledger.XMSnapshotReader, error)
- func (s *XModel) DoTx(tx *pb.Transaction, batch kvdb.Batch) error
- func (s *XModel) Get(bucket string, key []byte) (*kledger.VersionedData, error)
- func (s *XModel) GetFromLedger(txin *protos.TxInputExt) (*kledger.VersionedData, error)
- func (s *XModel) GetUncommited(bucket string, key []byte) (*kledger.VersionedData, error)
- func (s *XModel) GetWithTxStatus(bucket string, key []byte) (*kledger.VersionedData, bool, error)
- func (s *XModel) QueryBlock(blockid []byte) (*pb.InternalBlock, error)
- func (s *XModel) QueryTx(txid []byte) (*pb.Transaction, bool, error)
- func (s *XModel) Select(bucket string, startKey []byte, endKey []byte) (kledger.XMIterator, error)
- func (s *XModel) UndoTx(tx *pb.Transaction, batch kvdb.Batch) error
Constants ¶
const BucketSeperator = "/"
BucketSeperator separator between bucket and raw key
const DelFlag = "\x00"
DelFlag delete flag
const KVEngineType = "default"
KVEngineType KV storage type
const ( // TransientBucket is the name of bucket that only appears in tx output set // but does't persists in xmodel TransientBucket = "$transient" )
Variables ¶
This section is empty.
Functions ¶
func GenWriteKeyWithPrefix ¶
func GenWriteKeyWithPrefix(txOutputExt *protos.TxOutputExt) string
GenWriteKeyWithPrefix gen write key with perfix
func GetTxInputs ¶
func GetTxInputs(vds []*kledger.VersionedData) []*protos.TxInputExt
GetTxInputs get transaction inputs
func GetTxOutputs ¶
func GetTxOutputs(pds []*kledger.PureData) []*protos.TxOutputExt
GetTxOutputs get transaction outputs
func GetTxidFromVersion ¶
GetTxidFromVersion parse version and fetch txid from version string
func GetVersion ¶
func GetVersion(vd *kledger.VersionedData) string
GetVersion get VersionedData's version, if refTxid is nil, return ""
func GetVersionOfTxInput ¶
func GetVersionOfTxInput(txIn *protos.TxInputExt) string
GetVersionOfTxInput get version of TxInput
func IsEmptyVersionedData ¶
func IsEmptyVersionedData(vd *kledger.VersionedData) bool
IsEmptyVersionedData check if VersionedData is empty
func MakeRawKey ¶
MakeRawKey make key with bucket and raw key
func MakeVersion ¶
MakeVersion generate a version by txid and offset, version = txid_offset
func MarshalMessages ¶
MarshalMessages marshal protobuf message slice
func NewXMSnapshotReader ¶
func ParseContractUtxoInputs ¶
func ParseContractUtxoInputs(tx *pb.Transaction) ([]*protos.TxInput, error)
ParseContractUtxoInputs parse contract utxo inputs from tx write sets
func UnmsarshalMessages ¶
UnmsarshalMessages unmarshal protobuf messages to slice, x must be a pointer to message slice
Types ¶
type XMIterator ¶
type XMIterator struct {
// contains filtered or unexported fields
}
XMIterator data structure for XModel Iterator
func (*XMIterator) Error ¶
func (di *XMIterator) Error() error
Error return error info for XMIterator
func (*XMIterator) Value ¶
func (di *XMIterator) Value() *kledger.VersionedData
Data get data pointer to VersionedData for XMIterator
type XModel ¶
type XModel struct {
// contains filtered or unexported fields
}
XModel xmodel data structure
func (*XModel) BucketCacheDelete ¶
BucketCacheDelete gen write key with perfix
func (*XModel) CreateSnapshot ¶
func (*XModel) CreateXMSnapshotReader ¶
func (s *XModel) CreateXMSnapshotReader(blkId []byte) (kledger.XMSnapshotReader, error)
func (*XModel) GetFromLedger ¶
func (s *XModel) GetFromLedger(txin *protos.TxInputExt) (*kledger.VersionedData, error)
GetFromLedger get data directely from ledger
func (*XModel) GetUncommited ¶
GetUncommited get value for specific key, return the value with version, even it is in batch cache
func (*XModel) GetWithTxStatus ¶
GetWithTxStatus likes Get but also return tx status information
func (*XModel) QueryBlock ¶
func (s *XModel) QueryBlock(blockid []byte) (*pb.InternalBlock, error)
QueryBlock query block from ledger