Documentation ¶
Overview ¶
Package history provides a store for historical records. This package contains the interfaces and general types, see various foostore packages for actual store implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Slice ¶
type Slice interface { // Slice creates a new slice including records >= from and < to. // If from is zero then it is treated as the first record available, // if to is zero then it is the record immediately after the last record, // just like with go slices. // The record should have either ID and/or CreateTime set. Slice(from, to Record) Slice // Read reads records from the slice starting at the first record available, ending when into is full (according to len). // Read returns the number of records actually read. // The first record read will be places into index 0, the second into index 1, and so on. Read(ctx context.Context, into []Record) (int, error) // Len returns the number of records this slice represents. Len(ctx context.Context) (int, error) }
Slice describes a read-only ordered segment of a Store.
type Store ¶
type Store interface { // Append adds the given payload to the store, returning the Record as recorded. // The context can be used to abort the append operation if needed. Append(ctx context.Context, payload []byte) (Record, error) Slice }
Store defines an append-only collection of ordered records. The store can be sliced, like a go slice, to query for a range of records which can then be read.
Directories ¶
Path | Synopsis |
---|---|
Package boltstore provides an implementation of history.Store with records stored in a bolthold database.
|
Package boltstore provides an implementation of history.Store with records stored in a bolthold database. |
Package memstore provides an implementation of history.Store with records stored in memory.
|
Package memstore provides an implementation of history.Store with records stored in memory. |
Package pgxstore provides an implementation of history.Store backed by a Postgres database.
|
Package pgxstore provides an implementation of history.Store backed by a Postgres database. |
Click to show internal directories.
Click to hide internal directories.