Documentation ¶
Index ¶
- func ErrorFromElement(e Element) error
- func Int64FromElement(e Element) int64
- func NewNotFoundError(err error) error
- func NotFoundError(err error) bool
- type ChangeSet
- type ChangeSetElement
- type Clue
- type Element
- type ElementType
- type ErrorElement
- type Field
- type FieldScore
- type FieldScoreElement
- type FieldValue
- type FieldValueScore
- type FieldValueScoreElement
- type FieldsElement
- type Int64Element
- type Key
- type KeyField
- type KeyFieldValue
- type KeysElement
- type Presence
- type PresenceElement
- type Quorum
- type ValueScore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorFromElement ¶
ErrorFromElement attempts to get an error from the element if it exists.
func Int64FromElement ¶
Int64FromElement attempts to get an int from the element if it exists.
func NewNotFoundError ¶
NewNotFoundError creates a new NotFoundError
func NotFoundError ¶
NotFoundError finds if the error passed in, is actually a partial error or not
Types ¶
type ChangeSet ¶
ChangeSet defines success or failures when inserting into the storage. Each member is attached accordingly
func ChangeSetFromElement ¶
ChangeSetFromElement attempts to get an changeSet from the element if it exists.
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.
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 ¶
FieldsFromElement attempts to get an int from the element if it exists.
func (Field) MarshalJSON ¶
MarshalJSON represents a way of marshalling JSON to a slice of bytes Returns error on failure
func (*Field) UnmarshalJSON ¶
UnmarshalJSON represents a way of unmarshalling JSON from a series of bytes to a Field Returns error on failure
type FieldScore ¶
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 ¶
FieldValue represents the union of both a Field and a Value
type FieldValueScore ¶
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 ¶
func (f FieldValueScore) Equal(b FieldValueScore) bool
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 ¶
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 ¶
func (e *FieldValueScoreElement) Type() ElementType
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 ¶
KeysFromElement attempts to get an int from the element if it exists.
func (Key) MarshalJSON ¶
MarshalJSON represents a way of marshalling JSON to a slice of bytes Returns error on failure
func (*Key) UnmarshalJSON ¶
UnmarshalJSON represents a way of unmarshalling JSON from a series of bytes to a Field Returns error on failure
type KeyFieldValue ¶
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 ¶
Presence represents what state a cache item is in the underlying storage.
func PresenceFromElement ¶
PresenceFromElement attempts to get an presence from the element if it exists.
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 ¶
ParseQuorum returns a valid Quorum otherwise returns an error
type ValueScore ¶
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