Documentation ¶
Index ¶
- func Encode(b []byte) string
- func ExtractIndex(prefixedKey []byte) (uint64, error)
- type DB
- type Option
- type RangeDB
- func (db *RangeDB) Delete(index uint64, key []byte) error
- func (db *RangeDB) DeleteRange(from, to uint64) error
- func (db *RangeDB) Get(index uint64, key []byte) ([]byte, error)
- func (db *RangeDB) Has(index uint64, key []byte) (bool, error)
- func (db *RangeDB) Set(index uint64, key []byte, value []byte) error
- type RangeDBPruner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractIndex ¶
ExtractIndex extracts the index from a prefixed key.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents a filesystem backed key-value store. It is useful for storing amounts of data that exceed what is performant to store in a traditional key-value database.
type Option ¶
func WithAferoFS ¶
WithAferoFS sets the filesystem for the database. NOTE: Should only be used for testing.
func WithDirectoryPermissions ¶
WithDirectoryPermissions sets the permissions for the directory.
func WithFileExtension ¶
WithFileExtension sets the file extension for the database.
func WithLogger ¶
WithLogger sets the logger for the database.
func WithRootDirectory ¶
WithRootDirectory sets the root directory for the database.
type RangeDB ¶
RangeDB is a database that stores versioned data. It prefixes keys with an index.
func (*RangeDB) Delete ¶
Delete removes the value associated with the given index and key from the database. It prefixes the key with the index and a slash before deleting it from the underlying database.
func (*RangeDB) DeleteRange ¶
DeleteRange removes all values associated with the given index from the filesystem. It is INCLUSIVE of the `from` index and EXCLUSIVE of the `to“ index.
func (*RangeDB) Get ¶
Get retrieves the value associated with the given index and key. It prefixes the key with the index and a slash before querying the underlying database.
type RangeDBPruner ¶
type RangeDBPruner struct {
// contains filtered or unexported fields
}
RangeDBPruner prunes old indexes from the range DB.
func NewRangeDBPruner ¶
func NewRangeDBPruner( db *RangeDB, pruneWindow uint64, notifyNewIndex chan uint64, ) *RangeDBPruner
func (*RangeDBPruner) Start ¶
func (p *RangeDBPruner) Start(ctx context.Context)
Start starts a goroutine that listens for new indices to prune.