Documentation
¶
Overview ¶
Copyright (C) 2017, Zipper Team. All rights reserved.
This file is part of zipper ¶
The zipper is free software: you can use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
The zipper is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ISC License for more details.
You should have received a copy of the ISC License along with this program. If not, see <https://opensource.org/licenses/isc>.
Index ¶
- Constants
- type BlockchainDB
- func (blockchainDB *BlockchainDB) AtomicWrite(writeBatchs []*WriteBatch) error
- func (blockchainDB *BlockchainDB) Close()
- func (blockchainDB *BlockchainDB) Delete(cfName string, key []byte) error
- func (blockchainDB *BlockchainDB) Get(cfName string, key []byte) ([]byte, error)
- func (blockchainDB *BlockchainDB) GetByPrefix(cfName string, prefix []byte) []*KeyValue
- func (blockchainDB *BlockchainDB) GetByRange(cfName string, startkey []byte, limitKey []byte) []*KeyValue
- func (blockchainDB *BlockchainDB) Put(cfName string, key []byte, value []byte) error
- type CfHandlerMap
- type Config
- type KeyValue
- type WriteBatch
Constants ¶
const ( // OperationPut represents put operation OperationPut uint = iota // OperationDelete represents delete operation OperationDelete )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockchainDB ¶
BlockchainDB encapsulates rocksdb's structures
func (*BlockchainDB) AtomicWrite ¶
func (blockchainDB *BlockchainDB) AtomicWrite(writeBatchs []*WriteBatch) error
AtomicWrite writes batch
func (*BlockchainDB) Close ¶
func (blockchainDB *BlockchainDB) Close()
Close releases all column family handles and closes rocksdb
func (*BlockchainDB) Delete ¶
func (blockchainDB *BlockchainDB) Delete(cfName string, key []byte) error
Delete deletes the given key in the specified column family
func (*BlockchainDB) Get ¶
func (blockchainDB *BlockchainDB) Get(cfName string, key []byte) ([]byte, error)
Get returns the value for the given column family and key
func (*BlockchainDB) GetByPrefix ¶
func (blockchainDB *BlockchainDB) GetByPrefix(cfName string, prefix []byte) []*KeyValue
GetByPrefix for bulk reads
func (*BlockchainDB) GetByRange ¶
func (blockchainDB *BlockchainDB) GetByRange(cfName string, startkey []byte, limitKey []byte) []*KeyValue
GetByRange Range query
type CfHandlerMap ¶
type CfHandlerMap map[string]*gorocksdb.ColumnFamilyHandle
CfHandlerMap is columnfamilies handler set
type Config ¶
type Config struct {
DbPath string
Columnfamilies []string
KeepLogFileNumber int
MaxLogFileSize int
LogLevel string
}
Config is the configuration of the gorocksdb
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig defines the default configuration of the rocksdb
type WriteBatch ¶
WriteBatch wrappers batch operation
func NewWriteBatch ¶
func NewWriteBatch(cfName string, operation uint, key, value []byte, typ string) *WriteBatch
NewWriteBatch returns a writebatch instance