ledger

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

账本约束数据结构定义

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHandle

type BlockHandle interface {
	GetProposer() []byte
	GetHeight() int64
	GetBlockid() []byte
	GetConsensusStorage() ([]byte, error)
	GetTimestamp() int64
	SetItem(item string, value interface{}) error
	MakeBlockId() ([]byte, error)
	GetPreHash() []byte
	GetNextHash() []byte
	GetPublicKey() string
	GetSign() []byte
	GetTxIDs() []string
	GetInTrunk() bool
}

区块基础操作

type PureData

type PureData struct {
	Bucket string
	Key    []byte
	Value  []byte
}

func (*PureData) GetBucket

func (t *PureData) GetBucket() string

func (*PureData) GetKey

func (t *PureData) GetKey() []byte

func (*PureData) GetValue

func (t *PureData) GetValue() []byte

type VersionedData

type VersionedData struct {
	PureData  *PureData
	RefTxid   []byte
	RefOffset int32
}

func (*VersionedData) GetPureData

func (t *VersionedData) GetPureData() *PureData

func (*VersionedData) GetRefOffset

func (t *VersionedData) GetRefOffset() int32

func (*VersionedData) GetRefTxid

func (t *VersionedData) GetRefTxid() []byte

type XMIterator

type XMIterator interface {
	Key() []byte
	Value() *VersionedData
	Next() bool
	Error() error
	// Iterator 必须在使用完毕后关闭
	Close()
}

XMIterator iterates over key/value pairs in key order

type XMReader

type XMReader interface {
	//读取一个key的值,返回的value就是有版本的data
	Get(bucket string, key []byte) (*VersionedData, error)
	//扫描一个bucket中所有的kv, 调用者可以设置key区间[startKey, endKey)
	Select(bucket string, startKey []byte, endKey []byte) (XMIterator, error)
}

type XMSnapshotReader

type XMSnapshotReader interface {
	Get(bucket string, key []byte) ([]byte, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL