store

package
v0.0.0-...-4aff305 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

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

Bucket conforms to the Key/Val store interface and provides locking mechanism for each bucket.

func NewBucket

func NewBucket(file fsys.File, amountPerBucket int, logger log.Logger) *Bucket

NewBucket creates a store from a singular bucket

func (*Bucket) Delete

func (b *Bucket) Delete(field selectors.Field, value selectors.ValueScore) (selectors.ChangeSet, error)

Delete removes a member associated with a field and a store

func (*Bucket) Insert

func (b *Bucket) Insert(field selectors.Field, value selectors.ValueScore) (selectors.ChangeSet, error)

Insert inserts a member associated with a field and a store

func (*Bucket) Len

func (b *Bucket) Len() (int64, error)

Len returns the number of members

func (*Bucket) Members

func (b *Bucket) Members() ([]selectors.Field, error)

Members defines a way to return all members

func (*Bucket) Score

func (b *Bucket) Score(field selectors.Field) (selectors.Presence, error)

Score defines a way to find out the score associated with a field with in a key

func (*Bucket) Select

func (b *Bucket) Select(field selectors.Field) (selectors.FieldValueScore, error)

Select queries a set of members for an associated field

type Store

type Store interface {
	StoreContext

	// Insert takes a key and value and stores with in the underlying store.
	// Returns ChangeSet of success and failure
	Insert(selectors.Key, []selectors.FieldValueScore) (selectors.ChangeSet, error)

	// Delete removes a value associated with the key.
	// Returns ChangeSet of success and failure
	Delete(selectors.Key, []selectors.FieldValueScore) (selectors.ChangeSet, error)

	// Select retrieves a field and score associated with the store.
	// Returns Field, Value and Score if the value found
	Select(selectors.Key, selectors.Field) (selectors.FieldValueScore, error)

	// Keys returns all the potential keys that are stored with in the store.
	Keys() ([]selectors.Key, error)

	// Size returns the number of members for the key are stored in the store.
	Size(selectors.Key) (int64, error)

	// Members returns the members associated for a key
	Members(selectors.Key) ([]selectors.Field, error)

	// Score returns the specific score for the field with in the key.
	Score(selectors.Key, selectors.Field) (selectors.Presence, error)
}

Store represents a in-memory Key/Value implementation

func New

func New(fsys fsys.Filesystem, amountBuckets, amountPerBucket uint, logger log.Logger) (Store, error)

New creates a new in-memory Store according to the size required by the value requested.

type StoreContext

type StoreContext interface {
	String() string
}

StoreContext holds the base of the store

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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