Documentation
¶
Overview ¶
Package inmem is Harbor's V1 in-memory StateStore driver. It is the test reference for the conformance suite — every later driver (SQLite, Postgres, durable-log) inherits the same suite verbatim.
Internal model:
- A primary map keyed on (Quadruple, Kind) holds the active record per slot. A secondary map keyed on EventID resolves idempotency lookups and `LoadByEventID`.
- A single `sync.RWMutex` guards both maps. The driver does no I/O so contention is bounded by Go's map throughput; a finer-grained lock structure would be premature.
- `Bytes` is deep-copied on Save and on Load to defend against callers mutating the slice they passed in (or the slice they received). Future SQL drivers naturally avoid this issue (rows are independent of the caller's slice).
- `Close(ctx)` flips an atomic flag; subsequent calls return `ErrStoreClosed`. There are no driver-owned goroutines to join, so Close is fast.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(_ config.StateConfig) (state.StateStore, error)
New constructs a StateStore directly. Exposed for tests that want to skip the registry; production callers go through `state.Open`.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.