Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
Cache is a cache of documents, used for primary access to documents.
Writes/Deletes to the cache are queued and eventually written/removed to/from the storage via the txQueue.
Reads from the cache are performed directly.
To initialise a new Cache use the NewCache function which accepts a type of Queue.
func (*Cache) Delete ¶
Delete deletes a document from the cache. It will lock the cache and release it when the function returns.
type Condition ¶
type Condition struct { Field string `json:"field"` Operator Operator `json:"operator"` Value string `json:"value"` }
Condition is a condition to use in a query.
type Element ¶
func (*Element) UnmarshalJSON ¶
UnmarshalJSON overrides the default UnmarshalJSON for Element
type Event ¶
type Event struct { // Operation is the operation that was performed on the document. Operation Operation // Document is the document that was written to storage. Document *document.Document }
Event is an event that is emitted when a document is written to storage.
type Queue ¶
type Queue struct { Storage storage.Storage sync.RWMutex // contains filtered or unexported fields }
Queue is a queue of events to be processed by the cache so they can eventually be written to the storage.
If the maximum number of attempts is reached, the event is discarded.
The Queue will finish processing all events when receiving cancel signal and stop safely.
func (*Queue) WaitForShutdown ¶
func (q *Queue) WaitForShutdown()
WaitForShutdown waits for the queue to finish processing all events.