Documentation
¶
Overview ¶
Package persistence defines interfaces and tests for storing log state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogStatePersistence ¶
type LogStatePersistence interface {
// Init sets up the persistence layer. This should be idempotent,
// and will be called once per process startup.
Init(context.Context) error
// Latest returns the latest checkpoint.
// If no checkpoint exists, it must return nil.
Latest(ctx context.Context, origin string) ([]byte, error)
// Update allows for atomically updating the currently stored (if any)
// checkpoint for the given origin.
//
// The provided function will be passed the currently stored checkpoint
// for the provided log origin (or nil if no such checkpoint exists), and
// should return the serialised form of the updated checkpoint, or an
// error.
Update(ctx context.Context, origin string, f func([]byte) ([]byte, error)) error
}
LogStatePersistence is a handle on persistent storage for log state.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package inmemory provides a persistence implementation that lives only in memory.
|
Package inmemory provides a persistence implementation that lives only in memory. |
|
Package sql provides log state persistence backed by a SQL database.
|
Package sql provides log state persistence backed by a SQL database. |
Click to show internal directories.
Click to hide internal directories.