Documentation
¶
Overview ¶
Package inmem is Harbor's V1 in-memory MemoryStore driver. It is the test reference for the conformance suite — every later driver (SQLite + Postgres at Phase 25) inherits the same suite verbatim.
At Phase 24 the driver supports all three strategies:
- `none` — AddTurn is a no-op; GetLLMContext returns empty.
- `truncation` — recent-window buffer with `OverflowDropOldest` enforcement at the configured `BudgetTokens` boundary.
- `rolling_summary` — recent-window + background-summarised long-term context with the `healthy → retry → degraded → recovering → healthy` FSM. The injectable `memory.Summarizer` (LLM-backed at Phase 32+; stubbed via `strategy.EchoSummarizer` for tests) is consumed via `inmem.Options.Summarizer`.
Per D-027 (typed wrapper over StateStore), every successful mutation lands as a `state.StateStore` record at `Kind = "memory.state"` so the StateStore conformance suite covers the persistence path. The driver itself holds no per-key buffer state; everything lives behind the strategy executor.
Identity is mandatory at every method: empty tenant / user / session returns wrapped `memory.ErrIdentityRequired` AND publishes one `memory.identity_rejected` event on the injected EventBus.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(cfg memory.ConfigSnapshot, deps memory.Deps, opts Options) (memory.MemoryStore, error)
New constructs a `MemoryStore` directly. Exposed for tests + production callers that want full control over the strategy `Options`; production callers using `memory.Open` go through the registry, which (Phase 25a, D-174) threads `memory.Deps.Summarizer` into `Options` so every strategy — `none`, `truncation`, and `rolling_summary` — is registry-reachable.
An unknown strategy returns `memory.ErrStrategyNotImplemented`.
Types ¶
type Options ¶
type Options struct {
Summarizer memory.Summarizer
RecoveryBacklogMax int
}
Options carries InMem-driver-specific knobs that don't live on the generic `memory.ConfigSnapshot`. The summariser is the only Phase-24-relevant option; future drivers may add more.
`Summarizer` is REQUIRED when the configured strategy is `rolling_summary`. The `New` constructor rejects a nil summariser for that strategy with a wrapped error. As of Phase 25a (D-174) the registry path (`memory.Open`) injects the summariser via `memory.Deps.Summarizer`, so `rolling_summary` is registry- reachable too; this `Options.Summarizer` field remains for direct `New` callers that want explicit control.
`RecoveryBacklogMax` overrides the strategy default (16); zero uses the default. Operators set this through `config.MemoryConfig.RecoveryBacklogMax`; the registry-level `memory.Open` propagates the value via `ConfigSnapshot` (see Phase 24's `memory.ConfigSnapshot` extension).