Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the public interface to the key-value store that allows us to do operations like Set, Get, Delete, Clear and Compact on the internal.Store
func New ¶
func New(path string, maxKeys *uint64, redundantBlocks *uint16, poolCapacity *uint64, compactionInterval *uint32) (*Store, error)
New creates a new Store at the given path
func (*Store) Close ¶
Close frees up any resources occupied by store. After this, the store is unusable. You have to re-instantiate it or just run into some crazy errors
func (*Store) Compact ¶
Compact manually removes dangling key-value pairs in the database file
Dangling keys result from either getting expired or being deleted. When a Store.Delete operation is done, the actual key-value pair is just marked as `deleted` but is not removed.
Something similar happens when a key-value is updated. A new key-value pair is created and the old one is left un-indexed. Compaction is important because it reclaims this space and reduces the size of the database file.
This is done automatically for you at the set `compactionInterval` but you may wish to do it manually for some reason.
This is a very expensive operation so use it sparingly.