Versions in this module Expand all Collapse all v1 v1.2.0 May 22, 2024 Changes in this version + func IsError(err error, code ErrorCode) bool + func RegisterDriver(driver Driver) error + func SupportedDrivers() []string + func UseLogger(logger log.Logger) + type BlockRegion struct + Hash *hash.Hash + Len uint32 + Offset uint32 + type Bucket interface + Bucket func(key []byte) Bucket + CreateBucket func(key []byte) (Bucket, error) + CreateBucketIfNotExists func(key []byte) (Bucket, error) + Cursor func() Cursor + Delete func(key []byte) error + DeleteBucket func(key []byte) error + ForEach func(func(k, v []byte) error) error + ForEachBucket func(func(k []byte) error) error + Get func(key []byte) []byte + Put func(key, value []byte) error + Writable func() bool + type Cursor interface + Bucket func() Bucket + Delete func() error + First func() bool + Key func() []byte + Last func() bool + Next func() bool + Prev func() bool + Seek func(seek []byte) bool + Value func() []byte + type DB interface + Close func() error + Type func() string + Update func(fn func(tx Tx) error) error + View func(fn func(tx Tx) error) error + func Create(dbType string, args ...interface{}) (DB, error) + func Open(dbType string, args ...interface{}) (DB, error) + type Driver struct + Create func(args ...interface{}) (DB, error) + DbType string + Open func(args ...interface{}) (DB, error) + UseLogger func(logger log.Logger) + type Error struct + Description string + Err error + ErrorCode ErrorCode + func (e Error) Error() string + type ErrorCode int + const ErrBlockExists + const ErrBlockNotFound + const ErrBlockRegionInvalid + const ErrBucketExists + const ErrBucketNameRequired + const ErrBucketNotFound + const ErrCorruption + const ErrDbAlreadyOpen + const ErrDbDoesNotExist + const ErrDbExists + const ErrDbNotOpen + const ErrDbTypeRegistered + const ErrDbUnknownType + const ErrDriverSpecific + const ErrIncompatibleValue + const ErrInvalid + const ErrKeyRequired + const ErrKeyTooLarge + const ErrTxClosed + const ErrTxNotWritable + const ErrValueTooLarge + func (e ErrorCode) String() string + type Tx interface + Commit func() error + FetchBlock func(hash *hash.Hash) ([]byte, error) + FetchBlockHeader func(hash *hash.Hash) ([]byte, error) + FetchBlockHeaders func(hashes []hash.Hash) ([][]byte, error) + FetchBlockRegion func(region *BlockRegion) ([]byte, error) + FetchBlockRegions func(regions []BlockRegion) ([][]byte, error) + FetchBlocks func(hashes []hash.Hash) ([][]byte, error) + HasBlock func(hash *hash.Hash) (bool, error) + HasBlocks func(hashes []hash.Hash) ([]bool, error) + Metadata func() Bucket + Rollback func() error + StoreBlock func(block *types.SerializedBlock) error