Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item []byte
In Brute, an Item is a write operation and a record at the same time (excluding the Key). All write operations are required to be idempotent and commutative.
Brute is designed to store Key-Item-Pairs. Pairs with the same Key are merged, requiring these merge operations to be idempotent and commutative.
(This type is only here to attach some documentation onto it!)
type Merger ¶
type Merger interface { /* Clears and Inits the Merger, supplying the first Item. */ Init(item []byte) /* Merge another item */ Merge(item []byte) /* Returns true, if the Item supplied to .Init() differs from the Item returned by .Result()! Returns false otherwise. */ Changed() bool /* Returns the Items resulting from the merge operation. */ Result() []byte /* Cleans up the structure. Can be used to reduce the Memory-Footprint. */ Cleanup() }
The merger is a state automaton, that operates during reconciliation of "conflicting" writes (eg. writes that have the same key).
type MergerFactory ¶
type MergerFactory func() Merger
As a Merger-Object is single threaded, multiple instances are needed during multi-threaded operations.
For this, the MergerFactory is supplied.
type StorageFacade ¶
type StorageFacade interface { /* Submits (and potentially merges) a key-item-pair. Returns false, if the store was not writable during that operation. */ Submit(key, item []byte) (ok bool) /* Obtains an Item for the supplied key. If ok==false, no item had been found. If readable==false, the store was not readable during that operation. */ Obtain(key []byte) (item []byte, ok, readable bool) Stream(f func(key, item []byte)) }
An abstraction ontop of a Key-Item store.
A StorageFacade is assumed to posess a MergerFactory, so that this does not need to be supplied to it.