Documentation ¶
Index ¶
- Constants
- type ErrDuplicate
- type Iterator
- type Option
- func BurstRate(burstRate uint64) Option
- func FileCacheSize(size int) Option
- func GCInterval(gcInterval time.Duration) Option
- func GCTimeLimit(gcTimeLimit time.Duration) Option
- func IndexBitSize(indexBitSize uint8) Option
- func IndexFileSize(indexFileSize uint32) Option
- func PrimaryFileSize(fileSize uint32) Option
- func SyncInterval(syncInterval time.Duration) Option
- func SyncOnFlush(syncOnFlush bool) Option
- type Store
- func (s *Store) Close() error
- func (s *Store) Err() error
- func (s *Store) Flush() error
- 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) Index() *index.Index
- func (s *Store) IndexStorageSize() (int64, error)
- func (s *Store) NewIterator() *Iterator
- func (s *Store) Primary() primary.PrimaryStorage
- func (s *Store) PrimaryStorageSize() (int64, error)
- func (s *Store) Put(key []byte, newValue []byte) error
- func (s *Store) Remove(key []byte) (bool, error)
- func (s *Store) SetFileCacheSize(size int)
- func (s *Store) SetReturnErrorOnDuplicatePut(yes bool)
- func (s *Store) Start()
- func (s *Store) StorageSize() (int64, error)
Constants ¶
const ( // Primary types GsfaPrimary = "gsfaprimary" SigToEpochPrimary = "sig2epochprimary" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrDuplicate ¶
func (*ErrDuplicate) Error ¶
func (e *ErrDuplicate) Error() string
func (*ErrDuplicate) Is ¶
func (e *ErrDuplicate) Is(err error) bool
Is returns true if the error is an ErrDuplicate.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator iterates keys and values. Any write to the store potentially invalidates the iterator and may cause values to be missed or seen again.
type Option ¶
type Option func(*config)
func BurstRate ¶
BurstRate specifies how much data can accumulate in memory, at a rate faster than can be flushed, before causing a synchronous flush.
func FileCacheSize ¶
FileCacheSize is the number of open files the index file cache may keep.
func GCInterval ¶
GCInterval is the amount of time to wait between GC cycles. A value of 0 disables garbage collection.
func GCTimeLimit ¶
GCTimeLimit is the maximum amount of time that a GC cycle may run.
func IndexBitSize ¶
IndexBitSize is the number of bits in an index prefix.
func IndexFileSize ¶
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 PrimaryFileSize ¶
PrimaryFileSize is the maximum offset a primary record can have within an individual primary file, before the record must be stored in another file.
func SyncInterval ¶
SyncInterval determines how frequently changes are flushed to disk.
func SyncOnFlush ¶
SyncOnFlush, when set to true, causes fsync to be called as part of Flush.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func OpenStore ¶
func OpenStore(ctx context.Context, primaryType string, dataPath, indexPath string, options ...Option) (*Store, error)
OpenStore opens the index and returns a Store with the specified primary type.
Calling Store.Close closes the primary and freelist.
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 ¶
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 ¶
FreelistStorageSize returns the storage used by the freelist files.
func (*Store) IndexStorageSize ¶
IndexStorageSize returns the storage used by the index files.
func (*Store) NewIterator ¶
NewIterator creates a new store iterator.
func (*Store) Primary ¶
func (s *Store) Primary() primary.PrimaryStorage
func (*Store) PrimaryStorageSize ¶
PrimaryStorageSize returns the storage used by the primary storage files.
func (*Store) SetFileCacheSize ¶
func (*Store) SetReturnErrorOnDuplicatePut ¶
SetReturnErrorOnDuplicatePut sets whether to return an error when a duplicate key is inserted.
func (*Store) StorageSize ¶
StorageSize returns the storage used by the index, primary, and freelist files.
Directories ¶
Path | Synopsis |
---|---|
Package filecache provides an LRU cache of opened files.
|
Package filecache provides an LRU cache of opened files. |