Documentation
¶
Index ¶
- Constants
- func ReadFromContext(ctx context.Context) string
- func WithReadFrom(ctx context.Context, readFrom string) context.Context
- type Backend
- func (b *Backend) Capabilities() memory.Capabilities
- func (b *Backend) Delete(ctx context.Context, scope memory.Scope, kind, id string) error
- func (b *Backend) DeleteScope(ctx context.Context, scope memory.Scope) error
- func (b *Backend) Get(ctx context.Context, scope memory.Scope, kind, id string) (memory.Entry, bool, error)
- func (b *Backend) Put(ctx context.Context, e memory.Entry) error
- func (b *Backend) Query(ctx context.Context, q memory.Query) (memory.QueryResult, error)
- func (b *Backend) QueryAllScopes(ctx context.Context, q memory.CrossScopeQuery) (memory.QueryResult, error)
- func (b *Backend) Status(ctx context.Context, scope memory.Scope) (memory.ScopeStatus, error)
Constants ¶
View Source
const ( ReadFromPrimary = "primary" ReadFromSecondary = "secondary" )
Variables ¶
This section is empty.
Functions ¶
func ReadFromContext ¶
ReadFromContext returns the per-request readFrom override, or "".
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend dual-writes every mutation to both halves and serves reads from the one named by readFrom.
The secondary is the DURABLE half (the operator wires primary=inmem, secondary=postgres), so its write errors are authoritative and reach the caller under BOTH read sources. readFrom selects where reads are served, not which half is durable: swallowing a secondary write error under readFrom=primary is still silent permanent loss, because the ephemeral primary is gone on the next pod roll.
func (*Backend) Capabilities ¶
func (b *Backend) Capabilities() memory.Capabilities
func (*Backend) DeleteScope ¶
func (*Backend) QueryAllScopes ¶
func (b *Backend) QueryAllScopes(ctx context.Context, q memory.CrossScopeQuery) (memory.QueryResult, error)
Click to show internal directories.
Click to hide internal directories.