inmem

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL