Skip to main content

Module mem_management

Module mem_management 

Source
Expand description

Compiled lifecycle-policy rule sets — first-match-wins glob lookup over the [[mem_management.create]] / [[mem_management.delete]] arrays surfaced in workspace.toml.

The data carriers (crate::workspace::CreateRuleSetting, crate::workspace::DeleteRuleSetting) live with the workspace types in crate::workspace; this module owns the compiled matcher view that handlers call to decide whether a candidate mem path matches an operator-allowed rule.

Each rule’s pattern is a gitignore-style glob: * does not cross /; ** matches zero-or-more path segments. Matching is case-sensitive, no normalization. The matcher targets the composed candidate <path>/<name> (the mem’s full hierarchical branch path on the mem-repo) so rules can scope to a directory under the registry tree without separate path-glob plumbing. Flat-layout mems pass their leaf name as the candidate.

Boundary note. The lifecycle orchestrators (create_mem, delete_mem, their params/responses, the shared NOTE_MAX_LEN cap, the validate_mem_path helper) live in [memstead_engine::mem_management]. The matcher primitives stay here because the lean engine’s crate::Engine::cross_mem_link_allowed synthesises a CreateRuleSet on multi-folder workspaces — they are a lean policy primitive shared by both flavors.

Structs§

CreateRuleSet
Compiled [[mem_management.create]] rule set. Each rule is a pre-built globset::Glob plus the raw CreateRuleSetting. The underlying GlobSet carries the same globs in declaration order so Self::first_match resolves to the first-listed rule whose glob matches.
DeleteRuleSet
Compiled [[mem_management.delete]] rule set. Same first-match semantics as CreateRuleSet, minus the schema dimension.
MatcherSet
Compiled set of allowlist globs with gitignore semantics.

Enums§

MatcherSetError
Construction-time error for the matcher constructors. The ParseEntry variant names the offending entry string so callers can surface an actionable INVALID_INPUT envelope without re-deriving which entry blew up.