store

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2022 License: Apache-2.0, MIT Imports: 11 Imported by: 1

Documentation

Index

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

func BurstRate(burstRate uint64) Option

BurstRate specifies how much unwritten data can accumulate before causing data to be flushed to disk.

func GCInterval added in v0.2.0

func GCInterval(gcInterval time.Duration) Option

GCInterval is the amount of time to wait between GC cycles.

func GCScanFree added in v0.2.4

func GCScanFree(scanFree bool) Option

GCFreeScan enables a fast scan of files to find any that are not reverenced by any index buckets.

func GCTimeLimit added in v0.2.0

func GCTimeLimit(gcTimeLimit time.Duration) Option

GCTimeLimit is the maximum amount of time that a GC cycle may run.

func IndexBitSize added in v0.2.0

func IndexBitSize(indexBitSize uint8) Option

IndexBitSize is the number of bits in an index prefix.

func IndexFileSize added in v0.2.0

func IndexFileSize(indexFileSize uint32) Option

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

func SyncInterval(syncInterval time.Duration) Option

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

func (s *Store) Close() error

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) Err

func (s *Store) Err() error

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

func (s *Store) FreelistStorageSize() (int64, error)

FreelistStorageSize returns the storage used by the freelist files.

func (*Store) Get

func (s *Store) Get(key []byte) ([]byte, bool, error)

func (*Store) GetSize

func (s *Store) GetSize(key []byte) (types.Size, bool, error)

func (*Store) Has

func (s *Store) Has(key []byte) (bool, error)

func (*Store) IndexStorageSize added in v0.1.0

func (s *Store) IndexStorageSize() (int64, error)

IndexStorageSize returns the storage used by the index files.

func (*Store) PrimaryStorageSize added in v0.2.0

func (s *Store) PrimaryStorageSize() (int64, error)

PrimaryStorageSize returns the storage used by the primary storage files.

func (*Store) Put

func (s *Store) Put(key []byte, value []byte) error

func (*Store) Remove

func (s *Store) Remove(key []byte) (bool, error)

func (*Store) Start

func (s *Store) Start()

func (*Store) StorageSize added in v0.2.0

func (s *Store) StorageSize() (int64, error)

StorageSize returns the storage used by the index, primary, and freelist files.

Directories

Path Synopsis
cid

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL