common

package
v0.0.0-...-c8e9c26 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2018 License: LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataEntryPrefix

type DataEntryPrefix byte

DataEntryPrefix

const (
	// DATA
	DATA_BLOCK       DataEntryPrefix = 0x00
	DATA_HEADER                      = 0x01
	DATA_TRANSACTION                 = 0x02

	// Transaction
	ST_BOOKKEEPER DataEntryPrefix = 0x03
	ST_CONTRACT   DataEntryPrefix = 0x04
	ST_STORAGE    DataEntryPrefix = 0x05
	ST_VALIDATOR  DataEntryPrefix = 0x07
	ST_VOTE       DataEntryPrefix = 0x08

	IX_HEADER_HASH_LIST DataEntryPrefix = 0x09

	//SYSTEM
	SYS_CURRENT_BLOCK      DataEntryPrefix = 0x10
	SYS_VERSION            DataEntryPrefix = 0x11
	SYS_CURRENT_STATE_ROOT DataEntryPrefix = 0x12
	SYS_BLOCK_MERKLE_TREE  DataEntryPrefix = 0x13

	EVENT_NOTIFY DataEntryPrefix = 0x14
)

type EventStore

type EventStore interface {
	SaveEventNotifyByTx(txHash common.Uint256, notifies []*event.NotifyEventInfo) error
	SaveEventNotifyByBlock(height uint32, txHashs []common.Uint256) error
	GetEventNotifyByTx(txHash common.Uint256) ([]*event.NotifyEventInfo, error)
	CommitTo() error
}

type ItemState

type ItemState byte
const (
	None ItemState = iota
	Changed
	Deleted
)

type MemoryCacheStore

type MemoryCacheStore interface {
	Put(prefix byte, key []byte, value states.StateValue, state ItemState, trie bool)
	Get(prefix byte, key []byte) *StateItem
	Delete(prefix byte, key []byte)
	GetChangeSet() map[string]*StateItem
	Change(prefix byte, key []byte, trie bool)
}

type PersistStore

type PersistStore interface {
	Put(key []byte, value []byte) error
	Get(key []byte) ([]byte, error)
	Has(key []byte) (bool, error)
	Delete(key []byte) error
	NewBatch()
	BatchPut(key []byte, value []byte)
	BatchDelete(key []byte)
	BatchCommit() error
	Close() error
	NewIterator(prefix []byte) StoreIterator
}

type StateItem

type StateItem struct {
	Key   string
	Value states.StateValue
	State ItemState
	Trie  bool
}

type StateStore

type StateStore interface {
	TryAdd(prefix DataEntryPrefix, key []byte, value states.StateValue, trie bool)
	TryGetOrAdd(prefix DataEntryPrefix, key []byte, value states.StateValue, trie bool) error
	TryGet(prefix DataEntryPrefix, key []byte) (*StateItem, error)
	TryGetAndChange(prefix DataEntryPrefix, key []byte, trie bool) (states.StateValue, error)
	TryDelete(prefix DataEntryPrefix, key []byte)
	Find(prefix DataEntryPrefix, key []byte) ([]*StateItem, error)
}

type StoreIterator

type StoreIterator interface {
	Next() bool
	Prev() bool
	First() bool
	Last() bool
	Seek(key []byte) bool
	Key() []byte
	Value() []byte
	Release()
}

Jump to

Keyboard shortcuts

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