Documentation ¶
Index ¶
- Constants
- Variables
- func CheckEngine(dbPath string, createDatabaseIfNotExists bool, dbEngine hivedb.Engine) (hivedb.Engine, error)
- func NewRocksDB(path string, cacheSize uint64) (*rocksdb.RocksDB, error)
- func WithCacheSize(cacheSize uint64) options.Option[ChainStateDatabaseManager]
- 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, *sync.Mutex, 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 CacheSizeDefault = 1024 * 1024 * 32 )
Variables ¶
View Source
var AllowedEngines = []hivedb.Engine{ hivedb.EngineMapDB, hivedb.EngineRocksDB, }
Functions ¶
func CheckEngine ¶
func CheckEngine(dbPath string, createDatabaseIfNotExists bool, dbEngine 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 WithCacheSize ¶ added in v1.1.0
func WithCacheSize(cacheSize uint64) options.Option[ChainStateDatabaseManager]
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 New ¶
func New(databaseDirectory string, kvStore kvstore.KVStore, engine hivedb.Engine, compactionSupported bool, compactionRunningFunc func() bool) *Database
New creates a new Database instance.
func NewDatabase ¶ added in v1.1.0
func NewDatabase( dbEngine hivedb.Engine, path string, createDatabaseIfNotExists bool, autoFlush bool, cacheSize uint64, ) (*Database, error)
NewDatabase opens a database. It also checks if the database engine is correct.
func NewDatabaseInMemory ¶ added in v1.1.0
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.