state

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpmtIndex = "spmt-index"
	Nodes     = "spmt-nodes"
	Values    = "spmt-values"
)
View Source
const (
	SetOp = iota
	DeleteOp
)

Variables

View Source
var (
	EmptyRoot = HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
)

Functions

This section is empty.

Types

type GrpcMptKV

type GrpcMptKV struct {
	// contains filtered or unexported fields
}

func NewGrpcMptKV

func NewGrpcMptKV(kv IState) *GrpcMptKV

func (*GrpcMptKV) Commit

func (*GrpcMptKV) Delete

func (g *GrpcMptKV) Delete(_ context.Context, key *goproto.Key) (*emptypb.Empty, error)

func (*GrpcMptKV) Discard

func (*GrpcMptKV) DiscardAll

func (g *GrpcMptKV) DiscardAll(context.Context, *emptypb.Empty) (*emptypb.Empty, error)

func (*GrpcMptKV) Exist

func (g *GrpcMptKV) Exist(_ context.Context, key *goproto.Key) (*goproto.Bool, error)

func (*GrpcMptKV) Get

func (*GrpcMptKV) GetByBlockHash

func (g *GrpcMptKV) GetByBlockHash(_ context.Context, hash *goproto.KeyByHash) (*goproto.ValueResponse, error)

func (*GrpcMptKV) GetFinalized

func (g *GrpcMptKV) GetFinalized(_ context.Context, key *goproto.Key) (*goproto.ValueResponse, error)

func (*GrpcMptKV) NextTxn

func (*GrpcMptKV) Set

func (g *GrpcMptKV) Set(_ context.Context, keyValue *goproto.KeyValue) (*emptypb.Empty, error)

func (*GrpcMptKV) StartBlock

func (g *GrpcMptKV) StartBlock(_ context.Context, hash *goproto.TxnHash) (*emptypb.Empty, error)

type IState

type IState interface {
	Set(triName NameString, key, value []byte)
	Delete(triName NameString, key []byte)
	Get(triName NameString, key []byte) ([]byte, error)
	GetFinalized(triName NameString, key []byte) ([]byte, error)
	Exist(triName NameString, key []byte) bool
	GetByBlockHash(triName NameString, key []byte, blockHash Hash) ([]byte, error)
	Commit() ([]byte, error)
	NextTxn()
	Discard()
	DiscardAll()
	StartBlock(blockHash Hash)
	FinalizeBlock(blockHash Hash)
}

TODO: need to add prove() and verify()

func NewSpmtKV

func NewSpmtKV(root []byte, kvdb Kvdb) IState

func NewStateDB

func NewStateDB(kvdb kv.Kvdb) IState

type KvStash

type KvStash struct {
	Key   []byte
	Value []byte
	// contains filtered or unexported fields
}

type NameString

type NameString interface {
	Name() string
}

type Ops

type Ops int

type SpmtKV

type SpmtKV struct {
	// contains filtered or unexported fields
}

func (*SpmtKV) Commit

func (skv *SpmtKV) Commit() ([]byte, error)

Commit returns StateRoot or error

func (*SpmtKV) Delete

func (skv *SpmtKV) Delete(triName NameString, key []byte)

func (*SpmtKV) Discard

func (skv *SpmtKV) Discard()

func (*SpmtKV) DiscardAll

func (skv *SpmtKV) DiscardAll()

func (*SpmtKV) Exist

func (skv *SpmtKV) Exist(triName NameString, key []byte) bool

func (*SpmtKV) FinalizeBlock

func (skv *SpmtKV) FinalizeBlock(blockHash Hash)

func (*SpmtKV) Get

func (skv *SpmtKV) Get(triName NameString, key []byte) ([]byte, error)

func (*SpmtKV) GetByBlockHash

func (skv *SpmtKV) GetByBlockHash(triName NameString, key []byte, blockHash Hash) ([]byte, error)

FIXME

func (*SpmtKV) GetFinalized

func (skv *SpmtKV) GetFinalized(triName NameString, key []byte) ([]byte, error)

func (*SpmtKV) NextTxn

func (skv *SpmtKV) NextTxn()

func (*SpmtKV) Set

func (skv *SpmtKV) Set(triName NameString, key, value []byte)

func (*SpmtKV) StartBlock

func (skv *SpmtKV) StartBlock(blockHash Hash)

type TxnStashes

type TxnStashes struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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