Documentation
¶
Index ¶
- type Option
- type Store
- func (s *Store) Close() error
- func (s *Store) Err() error
- func (s *Store) Flush()
- func (s *Store) FreelistStorageSize() (int64, error)
- func (s *Store) Get(key []byte) ([]byte, bool, error)
- func (s *Store) GetSize(key []byte) (types.Size, bool, error)
- func (s *Store) Has(key []byte) (bool, error)
- func (s *Store) IndexStorageSize() (int64, error)
- func (s *Store) PrimaryStorageSize() (int64, error)
- func (s *Store) Put(key []byte, value []byte) error
- func (s *Store) Remove(key []byte) (bool, error)
- func (s *Store) Start()
- func (s *Store) StorageSize() (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v0.2.0
type Option func(*config)
func BurstRate ¶ added in v0.2.0
BurstRate specifies how much unwritten data can accumulate before causing data to be flushed to disk.
func GCInterval ¶ added in v0.2.0
GCInterval is the amount of time to wait between GC cycles.
func GCTimeLimit ¶ added in v0.2.0
GCTimeLimit is the maximum amount of time that a GC cycle may run.
func IndexBitSize ¶ added in v0.2.0
IndexBitSize is the number of bits in an index prefix.
func IndexFileSize ¶ added in v0.2.0
IndexFileSize is the maximum offset an index record can have within an individual index file, before the record must be stored in another file.
func SyncInterval ¶ added in v0.2.0
SyncInterval determines how frequently changes are flushed to disk.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func OpenStore ¶
func OpenStore(ctx context.Context, path string, primary primary.PrimaryStorage, immutable bool, options ...Option) (*Store, error)
OpenStore opens the index and freelist and returns a Store with the given primary.
Specifying 0 for indexSizeBits and indexFileSize results in using their default values. A gcInterval of 0 disables garbage collection.
func (*Store) Close ¶
Close stops store goroutines and calls Close on the index, primary, and freelist. This flushes any outstanding work and buffered data to their files.
func (*Store) Flush ¶
func (s *Store) Flush()
Flush writes outstanding work and buffered data to the primary, index, and freelist files. It then syncs these files to permanent storage.
func (*Store) FreelistStorageSize ¶ added in v0.2.0
FreelistStorageSize returns the storage used by the freelist files.
func (*Store) IndexStorageSize ¶ added in v0.1.0
IndexStorageSize returns the storage used by the index files.
func (*Store) PrimaryStorageSize ¶ added in v0.2.0
PrimaryStorageSize returns the storage used by the primary storage files.
func (*Store) StorageSize ¶ added in v0.2.0
StorageSize returns the storage used by the index, primary, and freelist files.