Documentation ¶
Index ¶
- Variables
- func CheckItemFlag(flg uint32) bool
- func DelPos(db DatabaseDeleter, flg uint32, key []byte) error
- func EncodeNumber(height uint32) []byte
- func Get(db DatabaseReader, key []byte) ([]byte, error)
- func GetCurrentBlock(db DatabaseReader) (common.Hash, error)
- func GetCurrentPos(db DatabaseReader, index int) (uint32, error)
- func Key(flag uint32, key []byte) []byte
- func Set(db DatabasePutter, key []byte, val []byte) error
- func SetCurrentBlock(db DatabasePutter, hash common.Hash) error
- func SetCurrentPos(db DatabasePutter, index int, pos uint32) error
- func SetPos(db DatabasePutter, flg uint32, key []byte, position *Position) error
- type Batch
- type DatabaseDeleter
- type DatabasePutter
- type DatabaseReader
- type LevelDBDatabase
- func (db *LevelDBDatabase) Close()
- func (db *LevelDBDatabase) Delete(key []byte) error
- func (db *LevelDBDatabase) Get(key []byte) ([]byte, error)
- func (db *LevelDBDatabase) Has(key []byte) (bool, error)
- func (db *LevelDBDatabase) LDB() *leveldb.DB
- func (db *LevelDBDatabase) Meter()
- func (db *LevelDBDatabase) NewBatch() Batch
- func (db *LevelDBDatabase) NewIterator() iterator.Iterator
- func (db *LevelDBDatabase) NewIteratorWithPrefix(prefix []byte) iterator.Iterator
- func (db *LevelDBDatabase) Path() string
- func (db *LevelDBDatabase) Put(key []byte, value []byte) error
- type Position
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ItemFlagStart = uint32(0) ItemFlagBlock = uint32(1) ItemFlagBlockHeight = uint32(2) ItemFlagTrie = uint32(3) ItemFlagAct = uint32(4) ItemFlagTxIndex = uint32(5) ItemFlagCode = uint32(6) ItemFlagKV = uint32(7) ItemFlagAssetCode = uint32(8) ItemFlagAssetId = uint32(9) ItemFlagStop = uint32(10) )
View Source
var ( BlockPrefix = []byte("B") BlockSuffix = []byte("b") BlockHeightPrefix = []byte("BH") BlockHeightSuffix = []byte("bh") // // headerPrefix + height (uint64 big endian) + heightSuffix -> hash AccountPrefix = []byte("A") AccountSuffix = []byte("a") TxPrefix = []byte("TX") TxSuffix = []byte("tx") AssetCodePrefix = []byte("AC") AssetCodeSuffix = []byte("ac") AssetIdPrefix = []byte("AI") AssetIdSuffix = []byte("ai") TrieNodePrefix = []byte("TN") TrieNodeSuffix = []byte("tn") CodePrefix = []byte("CC") CodeSuffix = []byte("cc") KVPrefix = []byte("KV") KVSuffix = []byte("kv") BitCaskCurrentOffsetPrefix = []byte("OFFSET") BitCaskCurrentOffsetSuffix = []byte("offset") StableBlockKey = []byte("LEMO-CURRENT-BLOCK") )
View Source
var OpenFileLimit = 64
Functions ¶
func CheckItemFlag ¶
func EncodeNumber ¶
func GetCurrentBlock ¶
func GetCurrentBlock(db DatabaseReader) (common.Hash, error)
func GetCurrentPos ¶
func GetCurrentPos(db DatabaseReader, index int) (uint32, error)
func SetCurrentBlock ¶
func SetCurrentBlock(db DatabasePutter, hash common.Hash) error
func SetCurrentPos ¶
func SetCurrentPos(db DatabasePutter, index int, pos uint32) error
Types ¶
type Batch ¶
type Batch interface { DatabasePutter ValueSize() int // amount of data in the batch Write() error // Reset resets the batch for reuse Reset() }
type DatabaseDeleter ¶
type DatabasePutter ¶
type DatabaseReader ¶
type LevelDBDatabase ¶
type LevelDBDatabase struct {
// contains filtered or unexported fields
}
func NewLevelDBDatabase ¶
func NewLevelDBDatabase(file string, cache int, handles int) *LevelDBDatabase
NewLDBDatabase returns a LevelDB wrapped object.
func (*LevelDBDatabase) Close ¶
func (db *LevelDBDatabase) Close()
func (*LevelDBDatabase) Delete ¶
func (db *LevelDBDatabase) Delete(key []byte) error
Delete deletes the key from the queue and database
func (*LevelDBDatabase) Get ¶
func (db *LevelDBDatabase) Get(key []byte) ([]byte, error)
Get returns the given key if it's present.
func (*LevelDBDatabase) LDB ¶
func (db *LevelDBDatabase) LDB() *leveldb.DB
func (*LevelDBDatabase) Meter ¶
func (db *LevelDBDatabase) Meter()
Meter configures the database metrics collectors and
func (*LevelDBDatabase) NewBatch ¶
func (db *LevelDBDatabase) NewBatch() Batch
func (*LevelDBDatabase) NewIterator ¶
func (db *LevelDBDatabase) NewIterator() iterator.Iterator
func (*LevelDBDatabase) NewIteratorWithPrefix ¶
func (db *LevelDBDatabase) NewIteratorWithPrefix(prefix []byte) iterator.Iterator
NewIteratorWithPrefix returns a iterator to iterate over subset of database content with a particular prefix.
func (*LevelDBDatabase) Path ¶
func (db *LevelDBDatabase) Path() string
Path returns the path to the database directory.
Click to show internal directories.
Click to hide internal directories.