Documentation ¶
Index ¶
- Constants
- func MustOpen(path string) kv.RwDB
- func MustOpenRo(path string) kv.RoDB
- func NewTemporaryMdbx(tempdir string) (kv.RwDB, error)
- func Open(path string, logger log.Logger, readOnly bool) (kv.RwDB, error)
- func PathDbMap() map[string]kv.RoDB
- func WithChaindataTables(defaultBuckets kv.TableCfg) kv.TableCfg
- type MdbxCursor
- func (c *MdbxCursor) Append(k []byte, v []byte) error
- func (c *MdbxCursor) Close()
- func (c *MdbxCursor) Count() (uint64, error)
- func (c *MdbxCursor) Current() ([]byte, []byte, error)
- func (c *MdbxCursor) Delete(k []byte) error
- func (c *MdbxCursor) DeleteCurrent() error
- func (c *MdbxCursor) First() ([]byte, []byte, error)
- func (c *MdbxCursor) Last() ([]byte, []byte, error)
- func (c *MdbxCursor) Next() (k, v []byte, err error)
- func (c *MdbxCursor) Prev() (k, v []byte, err error)
- func (c *MdbxCursor) Put(key []byte, value []byte) error
- func (c *MdbxCursor) PutNoOverwrite(key []byte, value []byte) error
- func (c *MdbxCursor) Seek(seek []byte) (k, v []byte, err error)
- func (c *MdbxCursor) SeekExact(key []byte) ([]byte, []byte, error)
- type MdbxDupSortCursor
- func (c *MdbxDupSortCursor) Append(k []byte, v []byte) error
- func (c *MdbxDupSortCursor) AppendDup(k []byte, v []byte) error
- func (c *MdbxDupSortCursor) CountDuplicates() (uint64, error)
- func (c *MdbxDupSortCursor) DeleteCurrentDuplicates() error
- func (c *MdbxDupSortCursor) DeleteExact(k1, k2 []byte) error
- func (c *MdbxDupSortCursor) FirstDup() ([]byte, error)
- func (c *MdbxDupSortCursor) Internal() *mdbx.Cursor
- func (c *MdbxDupSortCursor) LastDup() ([]byte, error)
- func (c *MdbxDupSortCursor) NextDup() ([]byte, []byte, error)
- func (c *MdbxDupSortCursor) NextNoDup() ([]byte, []byte, error)
- func (c *MdbxDupSortCursor) PrevDup() ([]byte, []byte, error)
- func (c *MdbxDupSortCursor) PrevNoDup() ([]byte, []byte, error)
- func (c *MdbxDupSortCursor) PutNoDupData(k, v []byte) error
- func (c *MdbxDupSortCursor) SeekBothExact(key, value []byte) ([]byte, []byte, error)
- func (c *MdbxDupSortCursor) SeekBothRange(key, value []byte) ([]byte, error)
- type MdbxKV
- func (db *MdbxKV) AllDBI() map[string]kv.DBI
- func (db *MdbxKV) AllTables() kv.TableCfg
- func (db *MdbxKV) BeginRo(ctx context.Context) (txn kv.Tx, err error)
- func (db *MdbxKV) BeginRw(ctx context.Context) (kv.RwTx, error)
- func (db *MdbxKV) BeginRwNosync(ctx context.Context) (kv.RwTx, error)
- func (db *MdbxKV) Close()
- func (db *MdbxKV) Env() *mdbx.Env
- func (db *MdbxKV) PageSize() uint64
- func (db *MdbxKV) ReadOnly() bool
- func (db *MdbxKV) Update(ctx context.Context, f func(tx kv.RwTx) error) (err error)
- func (db *MdbxKV) UpdateNosync(ctx context.Context, f func(tx kv.RwTx) error) (err error)
- func (db *MdbxKV) View(ctx context.Context, f func(tx kv.Tx) error) (err error)
- type MdbxOpts
- func (opts MdbxOpts) DBVerbosity(v kv.DBVerbosityLvl) MdbxOpts
- func (opts MdbxOpts) DirtySpace(s uint64) MdbxOpts
- func (opts MdbxOpts) Exclusive() MdbxOpts
- func (opts MdbxOpts) Flags(f func(uint) uint) MdbxOpts
- func (opts MdbxOpts) GetInMem() bool
- func (opts MdbxOpts) GetLabel() kv.Label
- func (opts MdbxOpts) GetPageSize() uint64
- func (opts MdbxOpts) GrowthStep(v datasize.ByteSize) MdbxOpts
- func (opts MdbxOpts) HasFlag(flag uint) bool
- func (opts MdbxOpts) InMem(tmpDir string) MdbxOpts
- func (opts MdbxOpts) Label(label kv.Label) MdbxOpts
- func (opts MdbxOpts) MapSize(sz datasize.ByteSize) MdbxOpts
- func (opts MdbxOpts) MustOpen() kv.RwDB
- func (opts MdbxOpts) Open() (kv.RwDB, error)
- func (opts MdbxOpts) PageSize(v uint64) MdbxOpts
- func (opts MdbxOpts) Path(path string) MdbxOpts
- func (opts MdbxOpts) Readonly() MdbxOpts
- func (opts MdbxOpts) RoTxsLimiter(l *semaphore.Weighted) MdbxOpts
- func (opts MdbxOpts) Set(opt MdbxOpts) MdbxOpts
- func (opts MdbxOpts) SyncPeriod(period time.Duration) MdbxOpts
- func (opts MdbxOpts) WithTableCfg(f TableCfgFunc) MdbxOpts
- func (opts MdbxOpts) WriteMap() MdbxOpts
- func (opts MdbxOpts) WriteMergeThreshold(v uint64) MdbxOpts
- type MdbxTx
- func (tx *MdbxTx) Append(bucket string, k, v []byte) error
- func (tx *MdbxTx) AppendDup(bucket string, k, v []byte) error
- func (tx *MdbxTx) BucketSize(name string) (uint64, error)
- func (tx *MdbxTx) BucketStat(name string) (*mdbx.Stat, error)
- func (tx *MdbxTx) ClearBucket(bucket string) error
- func (tx *MdbxTx) CollectMetrics()
- func (tx *MdbxTx) Commit() error
- func (tx *MdbxTx) CreateBucket(name string) error
- func (tx *MdbxTx) Cursor(bucket string) (kv.Cursor, error)
- func (tx *MdbxTx) CursorDupSort(bucket string) (kv.CursorDupSort, error)
- func (tx *MdbxTx) DBSize() (uint64, error)
- func (tx *MdbxTx) Delete(table string, k []byte) error
- func (tx *MdbxTx) DropBucket(bucket string) error
- func (tx *MdbxTx) ExistsBucket(bucket string) (bool, error)
- func (tx *MdbxTx) ForAmount(bucket string, fromPrefix []byte, amount uint32, ...) error
- func (tx *MdbxTx) ForEach(bucket string, fromPrefix []byte, walker func(k, v []byte) error) error
- func (tx *MdbxTx) ForPrefix(bucket string, prefix []byte, walker func(k, v []byte) error) error
- func (tx *MdbxTx) GetOne(bucket string, k []byte) ([]byte, error)
- func (tx *MdbxTx) Has(bucket string, key []byte) (bool, error)
- func (tx *MdbxTx) IncrementSequence(bucket string, amount uint64) (uint64, error)
- func (tx *MdbxTx) ListBuckets() ([]string, error)
- func (tx *MdbxTx) Prefix(table string, prefix []byte) (iter.KV, error)
- func (tx *MdbxTx) PrintDebugInfo()
- func (tx *MdbxTx) Put(table string, k, v []byte) error
- func (tx *MdbxTx) Range(table string, fromPrefix, toPrefix []byte) (iter.KV, error)
- func (tx *MdbxTx) RangeAscend(table string, fromPrefix, toPrefix []byte, limit int) (iter.KV, error)
- func (tx *MdbxTx) RangeDescend(table string, fromPrefix, toPrefix []byte, limit int) (iter.KV, error)
- func (tx *MdbxTx) RangeDupSort(table string, key []byte, fromPrefix, toPrefix []byte, asc order.By, limit int) (iter.KV, error)
- func (tx *MdbxTx) ReadSequence(bucket string) (uint64, error)
- func (tx *MdbxTx) Rollback()
- func (tx *MdbxTx) RwCursor(bucket string) (kv.RwCursor, error)
- func (tx *MdbxTx) RwCursorDupSort(bucket string) (kv.RwCursorDupSort, error)
- func (tx *MdbxTx) SpaceDirty() (uint64, uint64, error)
- func (tx *MdbxTx) ViewID() uint64
- type TableCfgFunc
- type TemporaryMdbx
- func (t *TemporaryMdbx) AllTables() kv.TableCfg
- func (t *TemporaryMdbx) BeginRo(ctx context.Context) (kv.Tx, error)
- func (t *TemporaryMdbx) BeginRw(ctx context.Context) (kv.RwTx, error)
- func (t *TemporaryMdbx) BeginRwNosync(ctx context.Context) (kv.RwTx, error)
- func (t *TemporaryMdbx) Close()
- func (t *TemporaryMdbx) PageSize() uint64
- func (t *TemporaryMdbx) ReadOnly() bool
- func (t *TemporaryMdbx) Update(ctx context.Context, f func(kv.RwTx) error) error
- func (t *TemporaryMdbx) UpdateNosync(ctx context.Context, f func(kv.RwTx) error) error
- func (t *TemporaryMdbx) View(ctx context.Context, f func(kv.Tx) error) error
Constants ¶
const NonExistingDBI kv.DBI = 999_999_999
Variables ¶
This section is empty.
Functions ¶
func MustOpenRo ¶
Types ¶
type MdbxCursor ¶
type MdbxCursor struct {
// contains filtered or unexported fields
}
func (*MdbxCursor) Append ¶
func (c *MdbxCursor) Append(k []byte, v []byte) error
Append - speedy feature of mdbx which is not part of KV interface. Cast your cursor to *MdbxCursor to use this method. Return error - if provided data will not sorted (or bucket have old records which mess with new in sorting manner).
func (*MdbxCursor) Close ¶
func (c *MdbxCursor) Close()
func (*MdbxCursor) Count ¶
func (c *MdbxCursor) Count() (uint64, error)
func (*MdbxCursor) Current ¶
func (c *MdbxCursor) Current() ([]byte, []byte, error)
Current - return key/data at current cursor position
func (*MdbxCursor) Delete ¶
func (c *MdbxCursor) Delete(k []byte) error
func (*MdbxCursor) DeleteCurrent ¶
func (c *MdbxCursor) DeleteCurrent() error
DeleteCurrent This function deletes the key/data pair to which the cursor refers. This does not invalidate the cursor, so operations such as MDB_NEXT can still be used on it. Both MDB_NEXT and MDB_GET_CURRENT will return the same record after this operation.
func (*MdbxCursor) Next ¶
func (c *MdbxCursor) Next() (k, v []byte, err error)
func (*MdbxCursor) Prev ¶
func (c *MdbxCursor) Prev() (k, v []byte, err error)
func (*MdbxCursor) PutNoOverwrite ¶
func (c *MdbxCursor) PutNoOverwrite(key []byte, value []byte) error
type MdbxDupSortCursor ¶
type MdbxDupSortCursor struct {
*MdbxCursor
}
func (*MdbxDupSortCursor) AppendDup ¶
func (c *MdbxDupSortCursor) AppendDup(k []byte, v []byte) error
func (*MdbxDupSortCursor) CountDuplicates ¶
func (c *MdbxDupSortCursor) CountDuplicates() (uint64, error)
CountDuplicates returns the number of duplicates for the current key. See mdb_cursor_count
func (*MdbxDupSortCursor) DeleteCurrentDuplicates ¶
func (c *MdbxDupSortCursor) DeleteCurrentDuplicates() error
DeleteCurrentDuplicates - delete all of the data items for the current key.
func (*MdbxDupSortCursor) DeleteExact ¶
func (c *MdbxDupSortCursor) DeleteExact(k1, k2 []byte) error
DeleteExact - does delete
func (*MdbxDupSortCursor) FirstDup ¶
func (c *MdbxDupSortCursor) FirstDup() ([]byte, error)
func (*MdbxDupSortCursor) Internal ¶
func (c *MdbxDupSortCursor) Internal() *mdbx.Cursor
func (*MdbxDupSortCursor) LastDup ¶
func (c *MdbxDupSortCursor) LastDup() ([]byte, error)
func (*MdbxDupSortCursor) NextDup ¶
func (c *MdbxDupSortCursor) NextDup() ([]byte, []byte, error)
NextDup - iterate only over duplicates of current key
func (*MdbxDupSortCursor) NextNoDup ¶
func (c *MdbxDupSortCursor) NextNoDup() ([]byte, []byte, error)
NextNoDup - iterate with skipping all duplicates
func (*MdbxDupSortCursor) PrevNoDup ¶
func (c *MdbxDupSortCursor) PrevNoDup() ([]byte, []byte, error)
func (*MdbxDupSortCursor) PutNoDupData ¶
func (c *MdbxDupSortCursor) PutNoDupData(k, v []byte) error
func (*MdbxDupSortCursor) SeekBothExact ¶
func (c *MdbxDupSortCursor) SeekBothExact(key, value []byte) ([]byte, []byte, error)
func (*MdbxDupSortCursor) SeekBothRange ¶
func (c *MdbxDupSortCursor) SeekBothRange(key, value []byte) ([]byte, error)
type MdbxKV ¶
type MdbxKV struct {
// contains filtered or unexported fields
}
func (*MdbxKV) BeginRwNosync ¶
func (*MdbxKV) Close ¶
func (db *MdbxKV) Close()
Close closes db All transactions must be closed before closing the database.
func (*MdbxKV) UpdateNosync ¶
type MdbxOpts ¶
type MdbxOpts struct {
// contains filtered or unexported fields
}
func (MdbxOpts) DBVerbosity ¶
func (opts MdbxOpts) DBVerbosity(v kv.DBVerbosityLvl) MdbxOpts
func (MdbxOpts) DirtySpace ¶
func (MdbxOpts) GetPageSize ¶
func (MdbxOpts) WithTableCfg ¶
func (opts MdbxOpts) WithTableCfg(f TableCfgFunc) MdbxOpts
func (MdbxOpts) WriteMergeThreshold ¶
type MdbxTx ¶
type MdbxTx struct {
// contains filtered or unexported fields
}
func (*MdbxTx) ClearBucket ¶
func (*MdbxTx) CollectMetrics ¶
func (tx *MdbxTx) CollectMetrics()
func (*MdbxTx) CreateBucket ¶
func (*MdbxTx) CursorDupSort ¶
func (tx *MdbxTx) CursorDupSort(bucket string) (kv.CursorDupSort, error)
func (*MdbxTx) DropBucket ¶
func (*MdbxTx) IncrementSequence ¶
func (*MdbxTx) ListBuckets ¶
ListBuckets - all buckets stored as keys of un-named bucket
func (*MdbxTx) PrintDebugInfo ¶
func (tx *MdbxTx) PrintDebugInfo()
func (*MdbxTx) RangeAscend ¶
func (*MdbxTx) RangeDescend ¶
func (*MdbxTx) RangeDupSort ¶
func (*MdbxTx) RwCursorDupSort ¶
func (tx *MdbxTx) RwCursorDupSort(bucket string) (kv.RwCursorDupSort, error)
type TemporaryMdbx ¶
type TemporaryMdbx struct {
// contains filtered or unexported fields
}
func (*TemporaryMdbx) AllTables ¶
func (t *TemporaryMdbx) AllTables() kv.TableCfg
func (*TemporaryMdbx) BeginRwNosync ¶
func (*TemporaryMdbx) Close ¶
func (t *TemporaryMdbx) Close()
func (*TemporaryMdbx) PageSize ¶
func (t *TemporaryMdbx) PageSize() uint64
func (*TemporaryMdbx) ReadOnly ¶
func (t *TemporaryMdbx) ReadOnly() bool