farm

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: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldValueScoresToKeyField

func FieldValueScoresToKeyField(key selectors.Key, members []selectors.FieldValueScore) []selectors.KeyFieldValue

FieldValueScoresToKeyField converts a slice of members to a slice of KeyField

func PartialError

func PartialError(err error) bool

PartialError finds if the error passed in, is actually a partial error or not

func UnionDifference

func UnionDifference(sets []TupleSet, quorum selectors.Quorum) ([]selectors.FieldValueScore, []selectors.FieldValueScore)

UnionDifference returns the union and difference from a slice of TupleSets

Types

type Farm

type Farm interface {

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

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

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

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

	// Size returns the number of members for the key are stored in the farm.
	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)

	// Repair attempts to repair the store depending on the elements
	Repair([]selectors.KeyFieldValue) error
}

Farm represents a in-memory Key/Value implementation

func NewNop

func NewNop() Farm

NewNop creates a new nop farm

func NewReal

func NewReal(nodes hashring.Snapshot) Farm

NewReal creates a farm that talks to various nodes

type TupleSet

TupleSet defines unique map of KeyField values

func MakeTupleSet

func MakeTupleSet(members []selectors.FieldValueScore) TupleSet

MakeTupleSet creates a new TupleSet with the results

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