Documentation
¶
Overview ¶
Package store defines the graph persistence abstraction (PRD section 30). The in-memory graph remains the default; a Neo4j-backed store provides durable, queryable storage for teams that want to keep graphs long-term or query them with Cypher.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("snapshot not found")
ErrNotFound is returned by Load for unknown keys.
Functions ¶
func IsNotFound ¶
IsNotFound reports whether err is (or wraps) ErrNotFound.
Types ¶
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore keeps snapshots in process memory. Useful for tests and as the default no-op backend.
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore returns an empty memory store.
type Neo4jConfig ¶
type Neo4jConfig struct {
// URI, e.g. neo4j://localhost:7687 or neo4j+s://host.
URI string
// Username (default "neo4j").
Username string
// Password (required).
Password string
// Database name (default "neo4j").
Database string
}
Neo4jConfig configures the connection.
type Neo4jStore ¶
type Neo4jStore struct {
// contains filtered or unexported fields
}
Neo4jStore persists graph snapshots in a Neo4j database (PRD section 30). Each snapshot is stored as a labeled subgraph:
(:AgentGraphSnapshot {key: <key>})-[:CONTAINS]->(:Node {id, ...})
(:Node)-[:Edge {type, confidence, risk, ...}]->(:Node)
Save replaces any existing snapshot with the same key in one transaction. The JSON snapshot blob is also kept on the snapshot node so Load can reconstruct exact metadata cheaply.
func NewNeo4jStore ¶
func NewNeo4jStore(ctx context.Context, cfg Neo4jConfig) (*Neo4jStore, error)
NewNeo4jStore connects to a Neo4j server and verifies connectivity.
type Store ¶
type Store interface {
// Name identifies the backend ("memory", "neo4j").
Name() string
// Save persists a complete graph snapshot, replacing any previous
// content with the same key.
Save(ctx context.Context, key string, g *graph.Graph) error
// Load reads a graph snapshot by key. Returns an error matching
// ErrNotFound when the key is unknown.
Load(ctx context.Context, key string) (*graph.Graph, error)
// Close releases backend resources.
Close() error
}
Store persists and loads graph snapshots.