common

package
v0.0.0-...-7718fd7 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Int64Size = 8
	HashSize  = sha256.Size

	LatestVersionKey = "s/latest"
	CommitInfoKeyFmt = "s/%d" // s/<version>
)

Variables

View Source
var (
	RootKeyFormat   = iavl.NewKeyFormat('r', Int64Size)                      // r<version>
	NodeKeyFormat   = iavl.NewKeyFormat('n', HashSize)                       // n<hash>
	OrphanKeyFormat = iavl.NewKeyFormat('o', Int64Size, Int64Size, HashSize) // o<last-version><first-version><hash>

)

Root nodes are indexed separately by their version

Functions

func Commit

func Commit(batches []dbm.Batch) error

func GetLatestVersion

func GetLatestVersion(db dbm.DB) int64

func OpenApplicationDB

func OpenApplicationDB(rootDir string) (dbm.DB, error)

func OpenBlockStoreDB

func OpenBlockStoreDB(rootDir string) (dbm.DB, error)

func OpenStateDB

func OpenStateDB(rootDir string) (dbm.DB, error)

func PrefixDB

func PrefixDB(key *sdk.KVStoreKey, originDB dbm.DB) *dbm.PrefixDB

Types

type Node

type Node struct {
	Hash      []byte
	LeftHash  []byte
	RightHash []byte
	Version   int64
	// contains filtered or unexported fields
}

Node represents a node in a Tree.

func MakeNode

func MakeNode(buf []byte) (*Node, error)

MakeNode constructs an *Node from an encoded byte slice.

The new node doesn't have its hash saved or set. The caller must set it afterwards.

func NewNode

func NewNode(key []byte, value []byte, version int64) *Node

NewNode returns a new node from a key, value and version.

Jump to

Keyboard shortcuts

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