Documentation
¶
Overview ¶
Package types holds the domain entities used throughout memmy.
Storage backends serialize these values into their native primitives (SQLite tables, Postgres rows, Bigtable column families). The shapes defined here are part of the design contract — see DESIGN.md §4.
Index ¶
- func CanonicalTenant(tuple map[string]string) string
- func TenantID(tuple map[string]string) string
- type DemoteRequest
- type DemoteResult
- type EdgeKind
- type ForgetRequest
- type ForgetResult
- type HNSWMeta
- type HNSWRecord
- type MarkRequest
- type MarkResult
- type MemoryEdge
- type Message
- type Node
- type RecallHit
- type RecallRequest
- type RecallResult
- type ReinforceRequest
- type ReinforceResult
- type ScoreBreakdown
- type StatsRequest
- type StatsResult
- type TenantInfo
- type WriteRequest
- type WriteResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalTenant ¶
CanonicalTenant returns the canonical string form of a tenant tuple: keys and values trimmed, keys sorted, separated by NUL bytes. Stable across runs and processes.
Types ¶
type DemoteRequest ¶
DemoteRequest / DemoteResult — explicit, caller-driven inhibition on a single node. The caller indicates "this hit was misleading or wrong." Weight is clamped at NodeFloor; the node is never deleted.
type DemoteResult ¶
type EdgeKind ¶
type EdgeKind uint8
EdgeKind classifies a memory association edge. Affects initial weight and decay rate; retrieval logic does not branch on Kind.
const ( // EdgeStructural — same source message or temporal adjacency. Created // at write time. Slow decay. EdgeStructural EdgeKind = iota // EdgeCoRetrieval — appeared together in the top-K seed set after // reranking. Created or reinforced at read time. EdgeCoRetrieval // EdgeCoTraversal — graph expansion hopped this edge AND the target // node ended up in the final returned result set. EdgeCoTraversal )
type ForgetRequest ¶
ForgetRequest / ForgetResult — see DESIGN.md §9.1.
type ForgetResult ¶
type HNSWMeta ¶
type HNSWMeta struct {
Dim int
EntryPoint string
MaxLayer int
M int
M0 int
EfConstruction int
EfSearch int
ML float64
Size int
}
HNSWMeta is per-tenant index metadata. Read fresh from the backend on every operation that needs it (no in-memory cache — DESIGN.md §0 #3).
type HNSWRecord ¶
HNSWRecord stores the per-node neighbor lists across all layers it participates in. Static after insert. See DESIGN.md §4.4.
type MarkRequest ¶
MarkRequest / MarkResult — retroactively boost every node in the tenant whose CreatedAt falls within [Since, now]. Strength scales the per-node delta; older nodes within the window receive a smaller share. See DESIGN.md §8.2.
type MarkResult ¶
type MemoryEdge ¶
type MemoryEdge struct {
From string
To string
TenantID string
Kind EdgeKind
Weight float64
LastTouched time.Time
CreatedAt time.Time
AccessCount uint64
TraverseCount uint64
}
MemoryEdge is a directed Hebbian association between two nodes. Distinct from HNSW navigation links. See DESIGN.md §4.3 / §7.5.
type Message ¶
type Message struct {
ID string
TenantID string
Text string
Metadata map[string]string
CreatedAt time.Time
}
Message is the original full text the caller wrote, persisted once and referenced by every chunk that came from it. See DESIGN.md §4.5.
type Node ¶
type Node struct {
ID string
TenantID string
SourceMsgID string
SentenceSpan [2]int
Text string
EmbeddingDim int
CreatedAt time.Time
LastTouched time.Time
Weight float64
AccessCount uint64
Tombstoned bool
}
Node is a chunk's metadata. The vector itself lives in the VectorIndex's `vectors` collection. See DESIGN.md §4.2.
type RecallRequest ¶
RecallRequest / RecallResult / RecallHit — see DESIGN.md §6, §9.1.
type RecallResult ¶
type RecallResult struct {
Results []RecallHit
}
type ReinforceRequest ¶
ReinforceRequest / ReinforceResult — explicit, caller-driven LTP bump on a single node. The caller indicates "this hit was useful in my answer." See DESIGN.md §8.2.
type ReinforceResult ¶
type ScoreBreakdown ¶
ScoreBreakdown is returned alongside RecallHit for explainability.
type StatsRequest ¶
StatsRequest / StatsResult — see DESIGN.md §9.1.
type StatsResult ¶
type TenantInfo ¶
TenantInfo is the entry registered in the `tenants` collection.
type WriteRequest ¶
WriteRequest / WriteResult — see DESIGN.md §9.1.