Documentation ¶
Index ¶
- type OpenchainDB
- func (openchainDB *OpenchainDB) Close()
- func (openchainDB *OpenchainDB) Delete(cfHandler *gorocksdb.ColumnFamilyHandle, key []byte) error
- func (openchainDB *OpenchainDB) DeleteState() error
- func (openchainDB *OpenchainDB) Get(cfHandler *gorocksdb.ColumnFamilyHandle, key []byte) ([]byte, 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) GetIterator(cfHandler *gorocksdb.ColumnFamilyHandle) *gorocksdb.Iterator
- 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
- func (openchainDB *OpenchainDB) Open()
- func (openchainDB *OpenchainDB) Put(cfHandler *gorocksdb.ColumnFamilyHandle, key []byte, value []byte) error
- type TestDBWrapper
- func (testDB *TestDBWrapper) CleanDB(t testing.TB)
- func (testDB *TestDBWrapper) CloseDB(t testing.TB)
- func (testDB *TestDBWrapper) CreateFreshDBGinkgo()
- func (testDB *TestDBWrapper) GetDBStats() string
- func (testDB *TestDBWrapper) GetEstimatedNumKeys(t testing.TB) map[string]string
- func (testDB *TestDBWrapper) GetFromDB(t testing.TB, key []byte) []byte
- func (testDB *TestDBWrapper) GetFromStateCF(t testing.TB, key []byte) []byte
- func (testDB *TestDBWrapper) GetFromStateDeltaCF(t testing.TB, key []byte) []byte
- func (testDB *TestDBWrapper) WriteToDB(t testing.TB, writeBatch *gorocksdb.WriteBatch)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OpenchainDB ¶
type OpenchainDB struct { DB *gorocksdb.DB BlockchainCF *gorocksdb.ColumnFamilyHandle StateCF *gorocksdb.ColumnFamilyHandle StateDeltaCF *gorocksdb.ColumnFamilyHandle IndexesCF *gorocksdb.ColumnFamilyHandle PersistCF *gorocksdb.ColumnFamilyHandle // contains filtered or unexported fields }
OpenchainDB encapsulates rocksdb's structures
func (*OpenchainDB) Close ¶
func (openchainDB *OpenchainDB) Close()
Close releases all column family handles and closes rocksdb
func (*OpenchainDB) Delete ¶
func (openchainDB *OpenchainDB) Delete(cfHandler *gorocksdb.ColumnFamilyHandle, key []byte) error
Delete delets the given key in the specified column family
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) Get ¶
func (openchainDB *OpenchainDB) Get(cfHandler *gorocksdb.ColumnFamilyHandle, key []byte) ([]byte, error)
Get returns the valud for the given column family and key
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) GetIterator ¶
func (openchainDB *OpenchainDB) GetIterator(cfHandler *gorocksdb.ColumnFamilyHandle) *gorocksdb.Iterator
GetIterator returns an iterator for the given column family
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
func (*OpenchainDB) Put ¶
func (openchainDB *OpenchainDB) Put(cfHandler *gorocksdb.ColumnFamilyHandle, key []byte, value []byte) error
Put saves the key/value in the given column family
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) CleanDB ¶
func (testDB *TestDBWrapper) CleanDB(t testing.TB)
CleanDB This method closes existing db, remove the db dir. Can be called before starting a test so that data from other tests does not interfere
func (*TestDBWrapper) CloseDB ¶
func (testDB *TestDBWrapper) CloseDB(t testing.TB)
CloseDB closes the db
func (*TestDBWrapper) CreateFreshDBGinkgo ¶
func (testDB *TestDBWrapper) CreateFreshDBGinkgo()
CreateFreshDBGinkgo creates a fresh database for ginkgo testing
func (*TestDBWrapper) GetDBStats ¶
func (testDB *TestDBWrapper) GetDBStats() string
GetDBStats returns statistics for the database
func (*TestDBWrapper) GetEstimatedNumKeys ¶
func (testDB *TestDBWrapper) GetEstimatedNumKeys(t testing.TB) map[string]string
GetEstimatedNumKeys returns estimated number of key-values in db. This is not accurate in all the cases
func (*TestDBWrapper) GetFromDB ¶
func (testDB *TestDBWrapper) GetFromDB(t testing.TB, key []byte) []byte
GetFromDB gets the value for the given key from default column-family
func (*TestDBWrapper) GetFromStateCF ¶
func (testDB *TestDBWrapper) GetFromStateCF(t testing.TB, 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.TB, 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.TB, writeBatch *gorocksdb.WriteBatch)
WriteToDB tests can use this method for persisting a given batch to db