compactedaol

package
v0.0.0-...-f456d84 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Storage path
	BasePath string
	// Sets a limit on the size of the records
	MaxRecordSize *int
	// If true, fsync will be called on every write
	Async *bool
	// MaxSegmentSize defines the maximum size of the segments, must be >=
	// MaxRecordSize
	MaxSegmentSize *int
	// CompactionThreshold defines the upper bound for how large a file can be
	// and still be subject to compaction
	CompactionThreshold *int
	// CompactionInterval defines the how often compaction should be run. Only
	// one compaction at a time will be run.
	CompactionInterval *time.Duration

	Logger *log.Logger
}

Config contains the configuration properties for the compacted aol store

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements the kvdb store interface providing a simple key-value database engine based on an append-log.

func NewStore

func NewStore(config Config) (*Store, error)

NewStore returns a new SimpleLogStore

func (*Store) Close

func (s *Store) Close() error

Close closes the store

func (*Store) Delete

func (s *Store) Delete(key string) error

Delete removes the value from the store and returns any error encountered

func (*Store) Get

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

Get returns the value associated with the key or a kvdb.NotFoundError if the key was not found, or any other error encountered

func (*Store) IsBadRequestError

func (s *Store) IsBadRequestError(err error) bool

IsBadRequestError returns true if the error, or any of the wrapped errors is of type BadRequestError

func (*Store) IsNotFoundError

func (s *Store) IsNotFoundError(err error) bool

IsNotFoundError returns true if the error signales that a non-existing key was requested

func (*Store) Put

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

Put saves the value to the database and returns any error encountered

Jump to

Keyboard shortcuts

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