Documentation ¶
Index ¶
- func CreateDB() error
- type OpenchainDB
- func (openchainDB *OpenchainDB) CloseDB()
- func (openchainDB *OpenchainDB) DeleteState() error
- func (openchainDB *OpenchainDB) GetBlockchainCFIterator() *gorocksdb.Iterator
- func (openchainDB *OpenchainDB) GetFromBlockchainCF(key []byte) ([]byte, error)
- func (openchainDB *OpenchainDB) GetFromBlockchainCFSnapshot(snapshot *gorocksdb.Snapshot, key []byte) ([]byte, error)
- func (openchainDB *OpenchainDB) GetFromIndexesCF(key []byte) ([]byte, error)
- func (openchainDB *OpenchainDB) GetFromStateCF(key []byte) ([]byte, error)
- func (openchainDB *OpenchainDB) GetFromStateDeltaCF(key []byte) ([]byte, error)
- func (openchainDB *OpenchainDB) GetSnapshot() *gorocksdb.Snapshot
- func (openchainDB *OpenchainDB) GetStateCFIterator() *gorocksdb.Iterator
- func (openchainDB *OpenchainDB) GetStateCFSnapshotIterator(snapshot *gorocksdb.Snapshot) *gorocksdb.Iterator
- func (openchainDB *OpenchainDB) GetStateDeltaCFIterator() *gorocksdb.Iterator
- type TestDBWrapper
- func (testDB *TestDBWrapper) CreateFreshDB(t *testing.T)
- func (testDB *TestDBWrapper) GetFromStateCF(t *testing.T, key []byte) []byte
- func (testDB *TestDBWrapper) GetFromStateDeltaCF(t *testing.T, key []byte) []byte
- func (testDB *TestDBWrapper) WriteToDB(t *testing.T, writeBatch *gorocksdb.WriteBatch)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OpenchainDB ¶
type OpenchainDB struct { DB *gorocksdb.DB BlockchainCF *gorocksdb.ColumnFamilyHandle StateCF *gorocksdb.ColumnFamilyHandle StateDeltaCF *gorocksdb.ColumnFamilyHandle IndexesCF *gorocksdb.ColumnFamilyHandle }
OpenchainDB encapsulates rocksdb's structures
func (*OpenchainDB) CloseDB ¶
func (openchainDB *OpenchainDB) CloseDB()
CloseDB releases all column family handles and closes rocksdb
func (*OpenchainDB) DeleteState ¶
func (openchainDB *OpenchainDB) DeleteState() error
DeleteState delets ALL state keys/values from the DB. This is generally only used during state synchronization when creating a new state from a snapshot.
func (*OpenchainDB) GetBlockchainCFIterator ¶
func (openchainDB *OpenchainDB) GetBlockchainCFIterator() *gorocksdb.Iterator
GetBlockchainCFIterator get iterator for column family - blockchainCF
func (*OpenchainDB) GetFromBlockchainCF ¶
func (openchainDB *OpenchainDB) GetFromBlockchainCF(key []byte) ([]byte, error)
GetFromBlockchainCF get value for given key from column family - blockchainCF
func (*OpenchainDB) GetFromBlockchainCFSnapshot ¶
func (openchainDB *OpenchainDB) GetFromBlockchainCFSnapshot(snapshot *gorocksdb.Snapshot, key []byte) ([]byte, error)
GetFromBlockchainCFSnapshot get value for given key from column family in a DB snapshot - blockchainCF
func (*OpenchainDB) GetFromIndexesCF ¶
func (openchainDB *OpenchainDB) GetFromIndexesCF(key []byte) ([]byte, error)
GetFromIndexesCF get value for given key from column family - indexCF
func (*OpenchainDB) GetFromStateCF ¶
func (openchainDB *OpenchainDB) GetFromStateCF(key []byte) ([]byte, error)
GetFromStateCF get value for given key from column family - stateCF
func (*OpenchainDB) GetFromStateDeltaCF ¶
func (openchainDB *OpenchainDB) GetFromStateDeltaCF(key []byte) ([]byte, error)
GetFromStateDeltaCF get value for given key from column family - stateDeltaCF
func (*OpenchainDB) GetSnapshot ¶
func (openchainDB *OpenchainDB) GetSnapshot() *gorocksdb.Snapshot
GetSnapshot returns a point-in-time view of the DB. You MUST call snapshot.Release() when you are done with the snapshot.
func (*OpenchainDB) GetStateCFIterator ¶
func (openchainDB *OpenchainDB) GetStateCFIterator() *gorocksdb.Iterator
GetStateCFIterator get iterator for column family - stateCF
func (*OpenchainDB) GetStateCFSnapshotIterator ¶
func (openchainDB *OpenchainDB) GetStateCFSnapshotIterator(snapshot *gorocksdb.Snapshot) *gorocksdb.Iterator
GetStateCFSnapshotIterator get iterator for column family - stateCF. This iterator is based on a snapshot and should be used for long running scans, such as reading the entire state. Remember to call iterator.Close() when you are done.
func (*OpenchainDB) GetStateDeltaCFIterator ¶
func (openchainDB *OpenchainDB) GetStateDeltaCFIterator() *gorocksdb.Iterator
GetStateDeltaCFIterator get iterator for column family - stateDeltaCF
type TestDBWrapper ¶
type TestDBWrapper struct {
// contains filtered or unexported fields
}
TestDBWrapper wraps the db. Can be used by other modules for testing
func NewTestDBWrapper ¶
func NewTestDBWrapper() *TestDBWrapper
NewTestDBWrapper constructs a new TestDBWrapper
func (*TestDBWrapper) CreateFreshDB ¶
func (testDB *TestDBWrapper) CreateFreshDB(t *testing.T)
CreateFreshDB This method closes existing db, remove the db dir and create db again. Can be called before starting a test so that data from other tests does not interfere
func (*TestDBWrapper) GetFromStateCF ¶
func (testDB *TestDBWrapper) GetFromStateCF(t *testing.T, key []byte) []byte
GetFromStateCF tests can use this method for getting value from StateCF column-family
func (*TestDBWrapper) GetFromStateDeltaCF ¶
func (testDB *TestDBWrapper) GetFromStateDeltaCF(t *testing.T, key []byte) []byte
GetFromStateDeltaCF tests can use this method for getting value from StateDeltaCF column-family
func (*TestDBWrapper) WriteToDB ¶
func (testDB *TestDBWrapper) WriteToDB(t *testing.T, writeBatch *gorocksdb.WriteBatch)
WriteToDB tests can use this method for persisting a given batch to db