base

package
v0.0.0-...-b124b1e Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LedgerSubModName = "ledger"
	StateSubModName  = "state"
	// ledger storage dir name
	LedgerStrgDirName = "ledger"
	// state machine storage dir name
	StateStrgDirName = "utxovm"
)
View Source
const (
	BlocksTablePrefix        = "B"
	UTXOTablePrefix          = "U"
	UnconfirmedTablePrefix   = "N"
	ConfirmedTablePrefix     = "C"
	MetaTablePrefix          = "M"
	PendingBlocksTablePrefix = "PB"
	ExtUtxoDelTablePrefix    = "ZD"
	ExtUtxoTablePrefix       = "ZU"
	BlockHeightPrefix        = "ZH"
	BranchInfoPrefix         = "ZI"
)

base definition for KV prefix

Variables

View Source
var (
	ErrKVNotFound = errors.New("Key not found")
	ErrP2PError   = errors.New("invalid stream")
)

Functions

func NormalizeKVError

func NormalizeKVError(err error) error

Types

type LedgerCtx

type LedgerCtx struct {
	// 基础上下文
	xctx.BaseCtx
	// 运行环境配置
	EnvCfg *xconf.EnvConf
	// 账本配置
	LedgerCfg *XLedgerConf
	// 链名
	BCName string
}

账本运行上下文环境

func NewLedgerCtx

func NewLedgerCtx(envCfg *xconf.EnvConf, bcName string) (*LedgerCtx, error)

type UtxoConfig

type UtxoConfig struct {
	CacheSize      int `yaml:"cachesize,omitempty"`
	TmpLockSeconds int `yaml:"tmplockSeconds,omitempty"`
}

type XLedgerConf

type XLedgerConf struct {
	// kv storage type
	KVEngineType   string     `yaml:"kvEngineType,omitempty"`
	OtherPaths     []string   `yaml:"otherPaths,omitempty"`
	StorageType    string     `yaml:"storageType,omitempty"`
	Utxo           UtxoConfig `yaml:"utxo,omitempty"`
	BlockCacheSize int        `yaml:"blockCacheSize,omitempty"`
	TxCacheSize    int        `yaml:"txCacheSize,omitempty"`
	MempoolTxLimit int        `yaml:"mempoolTxLimit,omitempty"`
}

func GetDefLedgerConf

func GetDefLedgerConf() *XLedgerConf

func LoadLedgerConf

func LoadLedgerConf(cfgFile string) (*XLedgerConf, error)

Jump to

Keyboard shortcuts

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