Documentation ¶
Index ¶
- Constants
- Variables
- func CheckEngine(dbPath string, createDatabaseIfNotExists bool, dbEngine hivedb.Engine, ...) (hivedb.Engine, error)
- func NewRocksDB(path string) (*rocksdb.RocksDB, error)
- func WithEngine(engine hivedb.Engine) options.Option[ChainStateDatabaseManager]
- func WithPath(databasePath string) options.Option[ChainStateDatabaseManager]
- type ChainStateDatabaseManager
- func (m *ChainStateDatabaseManager) AreStoresCorrupted() (bool, error)
- func (m *ChainStateDatabaseManager) AreStoresTainted() (bool, error)
- func (m *ChainStateDatabaseManager) ChainStateKVStore(chainID isc.ChainID) (kvstore.KVStore, error)
- func (m *ChainStateDatabaseManager) CheckCorrectStoresVersion() (bool, error)
- func (m *ChainStateDatabaseManager) FlushAndCloseStores() error
- func (m *ChainStateDatabaseManager) MarkStoresCorrupted() error
- func (m *ChainStateDatabaseManager) MarkStoresHealthy() error
- func (m *ChainStateDatabaseManager) MarkStoresTainted() error
- func (m *ChainStateDatabaseManager) UpdateStoresVersion() (bool, error)
- type ChainStateKVStoreProvider
- type Database
- type StoreVersionUpdateFunc
Constants ¶
View Source
const (
StoreVersionChainState byte = 1
)
Variables ¶
View Source
var ( AllowedEnginesDefault = []hivedb.Engine{ hivedb.EngineAuto, hivedb.EngineMapDB, hivedb.EngineRocksDB, } AllowedEnginesStorage = []hivedb.Engine{ hivedb.EngineRocksDB, } AllowedEnginesStorageAuto = append(AllowedEnginesStorage, hivedb.EngineAuto) )
Functions ¶
func CheckEngine ¶
func CheckEngine(dbPath string, createDatabaseIfNotExists bool, dbEngine hivedb.Engine, allowedEngines ...hivedb.Engine) (hivedb.Engine, error)
CheckEngine is a wrapper around hivedb.CheckEngine to throw a custom error message in case of engine mismatch.
func NewRocksDB ¶
NewRocksDB creates a new RocksDB instance.
func WithEngine ¶
func WithEngine(engine hivedb.Engine) options.Option[ChainStateDatabaseManager]
Types ¶
type ChainStateDatabaseManager ¶
type ChainStateDatabaseManager struct {
// contains filtered or unexported fields
}
func NewChainStateDatabaseManager ¶
func NewChainStateDatabaseManager(chainRecordRegistryProvider registry.ChainRecordRegistryProvider, opts ...options.Option[ChainStateDatabaseManager]) (*ChainStateDatabaseManager, error)
func (*ChainStateDatabaseManager) AreStoresCorrupted ¶
func (m *ChainStateDatabaseManager) AreStoresCorrupted() (bool, error)
func (*ChainStateDatabaseManager) AreStoresTainted ¶
func (m *ChainStateDatabaseManager) AreStoresTainted() (bool, error)
func (*ChainStateDatabaseManager) ChainStateKVStore ¶
func (*ChainStateDatabaseManager) CheckCorrectStoresVersion ¶
func (m *ChainStateDatabaseManager) CheckCorrectStoresVersion() (bool, error)
func (*ChainStateDatabaseManager) FlushAndCloseStores ¶
func (m *ChainStateDatabaseManager) FlushAndCloseStores() error
func (*ChainStateDatabaseManager) MarkStoresCorrupted ¶
func (m *ChainStateDatabaseManager) MarkStoresCorrupted() error
func (*ChainStateDatabaseManager) MarkStoresHealthy ¶
func (m *ChainStateDatabaseManager) MarkStoresHealthy() error
func (*ChainStateDatabaseManager) MarkStoresTainted ¶
func (m *ChainStateDatabaseManager) MarkStoresTainted() error
func (*ChainStateDatabaseManager) UpdateStoresVersion ¶
func (m *ChainStateDatabaseManager) UpdateStoresVersion() (bool, error)
UpdateStoresVersion tries to migrate the existing data to the new store version.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database holds the underlying KVStore and database specific functions.
func DatabaseWithDefaultSettings ¶
func DatabaseWithDefaultSettings(path string, createDatabaseIfNotExists bool, dbEngine hivedb.Engine, autoFlush bool, allowedEngines ...hivedb.Engine) (*Database, error)
DatabaseWithDefaultSettings returns a database with default settings. It also checks if the database engine is correct.
func New ¶
func New(databaseDirectory string, kvStore kvstore.KVStore, engine hivedb.Engine, compactionSupported bool, compactionRunningFunc func() bool) *Database
New creates a new Database instance.
func (*Database) CompactionRunning ¶
CompactionRunning returns whether a compaction is running.
func (*Database) CompactionSupported ¶
CompactionSupported returns whether the database engine supports compaction.
Click to show internal directories.
Click to hide internal directories.