Documentation
¶
Index ¶
- Constants
- func Equal(pd, vpd []*ledger.PureData) bool
- func GenWriteKeyWithPrefix(txOutputExt *protos.TxOutputExt) string
- func GetTxInputs(vds []*ledger.VersionedData) []*protos.TxInputExt
- func GetTxOutputs(pds []*ledger.PureData) []*protos.TxOutputExt
- func GetTxidFromVersion(version string) []byte
- func GetVersion(vd *ledger.VersionedData) string
- func GetVersionOfTxInput(txIn *protos.TxInputExt) string
- func IsEmptyVersionedData(vd *ledger.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 ledger.XReader) *xMSnapshotReader
- func ParseContractUtxoInputs(tx *protos.Transaction) ([]*protos.TxInput, error)
- func UnmarshalMerge(b []byte, m proto.Message) error
- func UnmsarshalMessages(p []byte, x interface{}) error
- type Buffer
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) DecodeMessage(m proto.Message) error
- func (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error)
- func (b *Buffer) DecodeVarint() (uint64, error)
- func (b *Buffer) EncodeMessage(m proto.Message) error
- func (b *Buffer) EncodeVarint(v uint64) error
- func (b *Buffer) Reset()
- func (b *Buffer) SetBuf(buf []byte)
- func (b *Buffer) Unread() []byte
- type ListCursor
- type XIterator
- type XModel
- func (s *XModel) BucketCacheDelete(bucket, version string)
- func (s *XModel) CleanCache()
- func (s *XModel) CreateSnapshot(blkId []byte) (ledger.XReader, error)
- func (s *XModel) CreateXMSnapshotReader(blkId []byte) (ledger.SnapshotReader, error)
- func (s *XModel) DoTx(tx *protos.Transaction, batch storage.Batch) error
- func (s *XModel) Get(bucket string, key []byte) (*ledger.VersionedData, error)
- func (s *XModel) GetFromLedger(txin *protos.TxInputExt) (*ledger.VersionedData, error)
- func (s *XModel) GetUncommited(bucket string, key []byte) (*ledger.VersionedData, error)
- func (s *XModel) GetWithTxStatus(bucket string, key []byte) (*ledger.VersionedData, bool, error)
- func (s *XModel) QueryBlock(blockid []byte) (*protos.InternalBlock, error)
- func (s *XModel) QueryTx(txid []byte) (*protos.Transaction, bool, error)
- func (s *XModel) Select(bucket string, startKey []byte, endKey []byte) (ledger.XIterator, error)
- func (s *XModel) UndoTx(tx *protos.Transaction, batch storage.Batch) error
- type XSnapshot
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 ¶
This section is empty.
Functions ¶
func GenWriteKeyWithPrefix ¶
func GenWriteKeyWithPrefix(txOutputExt *protos.TxOutputExt) string
GenWriteKeyWithPrefix gen write key with perfix
func GetTxInputs ¶
func GetTxInputs(vds []*ledger.VersionedData) []*protos.TxInputExt
GetTxInputs get transaction inputs
func GetTxOutputs ¶
func GetTxOutputs(pds []*ledger.PureData) []*protos.TxOutputExt
GetTxOutputs get transaction outputs
func GetTxidFromVersion ¶
GetTxidFromVersion parse version and fetch txid from version string
func GetVersion ¶
func GetVersion(vd *ledger.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 *ledger.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 *protos.Transaction) ([]*protos.TxInput, error)
ParseContractUtxoInputs parse contract utxo inputs from tx write sets
func UnmarshalMerge ¶
UnmarshalMerge parses a wire-format message in b and places the decoded results in m.
func UnmsarshalMessages ¶
UnmsarshalMessages unmarshal protobuf messages to slice, x must be a pointer to message slice
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a buffer for encoding and decoding the protobuf wire format. It may be reused between invocations to reduce memory usage.
func NewBuffer ¶
NewBuffer allocates a new Buffer initialized with buf, where the contents of buf are considered the unread portion of the buffer.
func (*Buffer) DecodeMessage ¶
DecodeMessage consumes a length-prefixed message from the buffer. It does not reset m before unmarshaling.
func (*Buffer) DecodeRawBytes ¶
DecodeRawBytes consumes a length-prefixed raw bytes from the buffer. If alloc is specified, it returns a copy the raw bytes rather than a sub-slice of the buffer.
func (*Buffer) DecodeVarint ¶
DecodeVarint consumes an encoded unsigned varint from the buffer.
func (*Buffer) EncodeMessage ¶
EncodeMessage appends a length-prefixed encoded message to the buffer.
func (*Buffer) EncodeVarint ¶
EncodeVarint appends an unsigned varint encoding to the buffer.
func (*Buffer) Reset ¶
func (b *Buffer) Reset()
Reset clears the internal buffer of all written and unread data.
type ListCursor ¶
type ListCursor struct {
// contains filtered or unexported fields
}
type XIterator ¶
type XIterator struct {
// contains filtered or unexported fields
}
XIterator data structure for XModel Iterator
func (*XIterator) Value ¶
func (di *XIterator) Value() *ledger.VersionedData
Data get data pointer to VersionedData for XIterator
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) (ledger.SnapshotReader, error)
func (*XModel) GetFromLedger ¶
func (s *XModel) GetFromLedger(txin *protos.TxInputExt) (*ledger.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) (*protos.InternalBlock, error)
QueryBlock query block from ledger