store

package
v0.0.0-...-9259d71 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package store store the world - state data

Index

Constants

This section is empty.

Variables

View Source
var EmptyRoot [32]byte

EmptyRoot mavl树空的根hash

Functions

func DisableLog

func DisableLog()

DisableLog disable log

func Reg

func Reg(name string, create Storecreate)

Reg 注册 store driver

func SetLogLevel

func SetLogLevel(level string)

SetLogLevel set log level

Types

type BaseStore

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

BaseStore 基础的store结构体

func NewBaseStore

func NewBaseStore(cfg *types.Store) *BaseStore

NewBaseStore new base store struct

func (*BaseStore) Close

func (store *BaseStore) Close()

Close 关闭BaseStore 相关资源包括数据库、client等

func (*BaseStore) GetDB

func (store *BaseStore) GetDB() dbm.DB

GetDB 返回 store db

func (*BaseStore) GetQueueClient

func (store *BaseStore) GetQueueClient() queue.Client

GetQueueClient 返回store模块的client

func (*BaseStore) SetChild

func (store *BaseStore) SetChild(sub SubStore)

SetChild 设置BaseStore中的子存储参数

func (*BaseStore) SetQueueClient

func (store *BaseStore) SetQueueClient(c queue.Client)

SetQueueClient set client queue for recv msg

type StoreListQuery

type StoreListQuery struct {
	*types.StoreListReply
	// contains filtered or unexported fields
}

func NewStoreListQuery

func NewStoreListQuery(store SubStore, req *types.StoreList) *StoreListQuery

func (*StoreListQuery) IterateCallBack

func (t *StoreListQuery) IterateCallBack(key, value []byte) bool

func (*StoreListQuery) Run

type Storecreate

type Storecreate func(cfg *types.Store, sub []byte) queue.Module

Storecreate store queue module

func Load

func Load(name string) (create Storecreate, err error)

Load load StoreCreate by name

type SubStore

type SubStore interface {
	Set(datas *types.StoreSet, sync bool) ([]byte, error)
	Get(datas *types.StoreGet) [][]byte
	MemSet(datas *types.StoreSet, sync bool) ([]byte, error)
	Commit(hash *types.ReqHash) ([]byte, error)
	Rollback(req *types.ReqHash) ([]byte, error)
	Del(req *types.StoreDel) ([]byte, error)
	IterateRangeByStateHash(statehash []byte, start []byte, end []byte, ascending bool, fn func(key, value []byte) bool)
	ProcEvent(msg queue.Message)
}

SubStore store db的操作接口

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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