selectors

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: 7 Imported by: 30

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorFromElement

func ErrorFromElement(e Element) error

ErrorFromElement attempts to get an error from the element if it exists.

func Int64FromElement

func Int64FromElement(e Element) int64

Int64FromElement attempts to get an int from the element if it exists.

func NewNotFoundError

func NewNotFoundError(err error) error

NewNotFoundError creates a new NotFoundError

func NotFoundError

func NotFoundError(err error) bool

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

Types

type ChangeSet

type ChangeSet struct {
	Success []Field
	Failure []Field
}

ChangeSet defines success or failures when inserting into the storage. Each member is attached accordingly

func ChangeSetFromElement

func ChangeSetFromElement(e Element) ChangeSet

ChangeSetFromElement attempts to get an changeSet from the element if it exists.

func (ChangeSet) Append

func (c ChangeSet) Append(v ChangeSet) ChangeSet

Append a new ChangeSet to the existing ChangeSet

func (ChangeSet) Equal

func (c ChangeSet) Equal(v ChangeSet) bool

Equal checks to see if a ChangeSet matches another ChangeSet

type ChangeSetElement

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

ChangeSetElement defines a struct that is a container for errors.

func NewChangeSetElement

func NewChangeSetElement(hash uint32, val ChangeSet) *ChangeSetElement

NewChangeSetElement creates a new ChangeSetElement

func (*ChangeSetElement) ChangeSet

func (e *ChangeSetElement) ChangeSet() ChangeSet

ChangeSet defines the changeSet associated with the ChangeSetElement

func (*ChangeSetElement) Hash

func (e *ChangeSetElement) Hash() uint32

Hash defines the hash associated with the ChangeSetElement

func (*ChangeSetElement) Type

func (e *ChangeSetElement) Type() ElementType

Type defines the type associated with the ChangeSetElement

type Clue

type Clue struct {
	Ignore bool
	Insert bool
	Key    Key
	Field  Field
	Value  []byte
	Score  int64
	Quorum bool
}

Clue represents if a value needs repairing and to what end.

func (Clue) SetKeyFieldValue

func (c Clue) SetKeyFieldValue(key Key, field Field, value []byte) Clue

SetKeyFieldValue allows the setting of the key and field on the clue. This does not mutate the Clue

type Element

type Element interface {

	// Type returns the element type, so a switch can be performed on it
	Type() ElementType

	// Hash returns the associated hash the element came from
	Hash() uint32
}

Element combines a submitted key with the resulting values. If there was an error while selecting a key, the error field will be populated.

type ElementType

type ElementType int

ElementType defines the type of element to expect over the wire.

const (
	// ErrorElementType describes an element with a error payload
	ErrorElementType ElementType = iota

	// Int64ElementType describes an element with an int64 payload
	Int64ElementType

	// KeysElementType describes an element with an a slice of keys payload
	KeysElementType

	// FieldsElementType describes an element with a slice of fields payload
	FieldsElementType

	// ChangeSetElementType describes an element with an change set payload
	ChangeSetElementType

	// PresenceElementType describes an element with an presence payload
	PresenceElementType

	// FieldScoreElementType describes an element with a field score payload
	FieldScoreElementType

	// FieldValueScoreElementType describes an element with a field, value score payload
	FieldValueScoreElementType
)

type ErrorElement

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

ErrorElement defines a struct that is a container for errors.

func NewErrorElement

func NewErrorElement(hash uint32, err error) *ErrorElement

NewErrorElement creates a new ErrorElement

func (*ErrorElement) Error

func (e *ErrorElement) Error() error

Error defines the error associated with the ErrorElement

func (*ErrorElement) Hash

func (e *ErrorElement) Hash() uint32

Hash defines the hash associated with the ErrorElement

func (*ErrorElement) Type

func (e *ErrorElement) Type() ElementType

Type defines the type associated with the ErrorElement

type Field

type Field string

Field represents a field value in a cache

func FieldsFromElement

func FieldsFromElement(e Element) []Field

FieldsFromElement attempts to get an int from the element if it exists.

func (Field) Equal

func (f Field) Equal(b Field) bool

Equal checks to see if a Field matches another Field

func (Field) Generate

func (Field) Generate(r *rand.Rand, size int) reflect.Value

Generate allows Field to be used within quickcheck scenarios.

func (Field) MarshalJSON

func (f Field) MarshalJSON() ([]byte, error)

MarshalJSON represents a way of marshalling JSON to a slice of bytes Returns error on failure

func (Field) String

func (f Field) String() string

func (*Field) UnmarshalJSON

func (f *Field) UnmarshalJSON(data []byte) error

UnmarshalJSON represents a way of unmarshalling JSON from a series of bytes to a Field Returns error on failure

type FieldScore

type FieldScore struct {
	Field Field
	Score int64
}

FieldScore represents the union of both a Field and a Score

func FieldScoreFromElement

func FieldScoreFromElement(e Element) FieldScore

FieldScoreFromElement attempts to get an fieldScore from the element if it exists.

type FieldScoreElement

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

FieldScoreElement defines a struct that is a container for errors.

func NewFieldScoreElement

func NewFieldScoreElement(hash uint32, val FieldScore) *FieldScoreElement

NewFieldScoreElement creates a new FieldScoreElement

func (*FieldScoreElement) FieldScore

func (e *FieldScoreElement) FieldScore() FieldScore

FieldScore defines the fieldScore associated with the FieldScoreElement

func (*FieldScoreElement) Hash

func (e *FieldScoreElement) Hash() uint32

Hash defines the hash associated with the FieldScoreElement

func (*FieldScoreElement) Type

func (e *FieldScoreElement) Type() ElementType

Type defines the type associated with the FieldScoreElement

type FieldValue

type FieldValue struct {
	Field Field
	Value []byte
}

FieldValue represents the union of both a Field and a Value

type FieldValueScore

type FieldValueScore struct {
	Field Field
	Value []byte
	Score int64
}

FieldValueScore represents a field, value and score for the store

func FieldValueScoreFromElement

func FieldValueScoreFromElement(e Element) FieldValueScore

FieldValueScoreFromElement attempts to get an fieldValueScore from the element if it exists.

func (FieldValueScore) Equal

Equal checks to see if a FieldValueScore matches another FieldValueScore

func (FieldValueScore) FieldScore

func (f FieldValueScore) FieldScore() FieldScore

FieldScore returns a FieldScore from a FieldValueScore

func (FieldValueScore) Generate

func (FieldValueScore) Generate(r *rand.Rand, size int) reflect.Value

Generate allows FieldValueScore to be used within quickcheck scenarios.

func (FieldValueScore) ValueScore

func (f FieldValueScore) ValueScore() ValueScore

ValueScore returns a ValueScore from a FieldValueScore

type FieldValueScoreElement

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

FieldValueScoreElement defines a struct that is a container for errors.

func NewFieldValueScoreElement

func NewFieldValueScoreElement(hash uint32, val FieldValueScore) *FieldValueScoreElement

NewFieldValueScoreElement creates a new FieldValueScoreElement

func (*FieldValueScoreElement) FieldValueScore

func (e *FieldValueScoreElement) FieldValueScore() FieldValueScore

FieldValueScore defines the fieldValueScore associated with the FieldValueScoreElement

func (*FieldValueScoreElement) Hash

func (e *FieldValueScoreElement) Hash() uint32

Hash defines the hash associated with the FieldValueScoreElement

func (*FieldValueScoreElement) Type

Type defines the type associated with the FieldValueScoreElement

type FieldsElement

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

FieldsElement defines a struct that is a container for errors.

func NewFieldsElement

func NewFieldsElement(hash uint32, val []Field) *FieldsElement

NewFieldsElement creates a new FieldsElement

func (*FieldsElement) Fields

func (e *FieldsElement) Fields() []Field

Fields defines the []Field associated with the FieldsElement

func (*FieldsElement) Hash

func (e *FieldsElement) Hash() uint32

Hash defines the hash associated with the FieldsElement

func (*FieldsElement) Type

func (e *FieldsElement) Type() ElementType

Type defines the type associated with the FieldsElement

type Int64Element

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

Int64Element defines a struct that is a container for errors.

func NewInt64Element

func NewInt64Element(hash uint32, val int64) *Int64Element

NewInt64Element creates a new Int64Element

func (*Int64Element) Hash

func (e *Int64Element) Hash() uint32

Hash defines the hash associated with the Int64Element

func (*Int64Element) Int64

func (e *Int64Element) Int64() int64

Int64 defines the int64 associated with the 6464Element

func (*Int64Element) Type

func (e *Int64Element) Type() ElementType

Type defines the type associated with the Int64Element

type Key

type Key string

Key represents a Key in a cache

func KeysFromElement

func KeysFromElement(e Element) []Key

KeysFromElement attempts to get an int from the element if it exists.

func (Key) Equal

func (k Key) Equal(b Key) bool

Equal checks to see if a Key matches another Key

func (Key) Generate

func (Key) Generate(r *rand.Rand, size int) reflect.Value

Generate allows Field to be used within quickcheck scenarios.

func (Key) Hash

func (k Key) Hash() uint32

Hash returns the hash (uint32) value of the Key union

func (Key) MarshalJSON

func (k Key) MarshalJSON() ([]byte, error)

MarshalJSON represents a way of marshalling JSON to a slice of bytes Returns error on failure

func (Key) String

func (k Key) String() string

func (*Key) UnmarshalJSON

func (k *Key) UnmarshalJSON(data []byte) error

UnmarshalJSON represents a way of unmarshalling JSON from a series of bytes to a Field Returns error on failure

type KeyField

type KeyField struct {
	Key   Key
	Field Field
}

KeyField defines the union of both the Key and Field

func (KeyField) Hash

func (k KeyField) Hash() uint32

Hash returns the hash (uint32) value of the KeyField union

type KeyFieldValue

type KeyFieldValue struct {
	Key   Key
	Field Field
	Value []byte
}

KeyFieldValue defines the union of both the Key, Field and Value

func (KeyFieldValue) Hash

func (k KeyFieldValue) Hash() uint32

Hash returns the hash (uint32) value of the KeyField union

type KeysElement

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

KeysElement defines a struct that is a container for errors.

func NewKeysElement

func NewKeysElement(hash uint32, val []Key) *KeysElement

NewKeysElement creates a new KeysElement

func (*KeysElement) Hash

func (e *KeysElement) Hash() uint32

Hash defines the hash associated with the KeysElement

func (*KeysElement) Keys

func (e *KeysElement) Keys() []Key

Keys defines the []Key associated with the KeysElement

func (*KeysElement) Type

func (e *KeysElement) Type() ElementType

Type defines the type associated with the KeysElement

type Presence

type Presence struct {
	Present  bool
	Inserted bool
	Score    int64
}

Presence represents what state a cache item is in the underlying storage.

func PresenceFromElement

func PresenceFromElement(e Element) Presence

PresenceFromElement attempts to get an presence from the element if it exists.

func (Presence) Equal

func (p Presence) Equal(b Presence) bool

Equal checks to see if a Presence matches another Presences

type PresenceElement

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

PresenceElement defines a struct that is a container for errors.

func NewPresenceElement

func NewPresenceElement(hash uint32, val Presence) *PresenceElement

NewPresenceElement creates a new PresenceElement

func (*PresenceElement) Hash

func (e *PresenceElement) Hash() uint32

Hash defines the hash associated with the PresenceElement

func (*PresenceElement) Presence

func (e *PresenceElement) Presence() Presence

Presence defines the presence associated with the PresenceElement

func (*PresenceElement) Type

func (e *PresenceElement) Type() ElementType

Type defines the type associated with the PresenceElement

type Quorum

type Quorum string

Quorum defines the types of different consensus algorithms we want to achieve These are various strategy patterns.

const (
	// One defines the need for only one node to be satisfied
	One Quorum = "one"

	// Strong defines the need for all nodes to be read and // written against,
	// anything less is a failure
	Strong Quorum = "strong"

	// Consensus defines the need for only 51% or more nodes to be read and
	// written against, anything less is a failure
	Consensus Quorum = "consensus"
)

func ParseQuorum

func ParseQuorum(s string) (Quorum, error)

ParseQuorum returns a valid Quorum otherwise returns an error

func (Quorum) String

func (q Quorum) String() string

type ValueScore

type ValueScore struct {
	Value []byte
	Score int64
}

ValueScore represents both a value and score for the store

func (ValueScore) Equal

func (f ValueScore) Equal(b ValueScore) bool

Equal checks to see if a ValueScore matches another ValueScore

func (ValueScore) Generate

func (ValueScore) Generate(r *rand.Rand, size int) reflect.Value

Generate allows ValueScore to be used within quickcheck scenarios.

Jump to

Keyboard shortcuts

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