store

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
var ErrNotFound = errors.New("snapshot not found")

ErrNotFound is returned by Load for unknown keys.

Functions

func IsNotFound

func IsNotFound(err error) bool

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.

func (*MemoryStore) Close

func (m *MemoryStore) Close() error

Close implements Store.

func (*MemoryStore) Load

func (m *MemoryStore) Load(_ context.Context, key string) (*graph.Graph, error)

Load implements Store.

func (*MemoryStore) Name

func (m *MemoryStore) Name() string

Name implements Store.

func (*MemoryStore) Save

func (m *MemoryStore) Save(_ context.Context, key string, g *graph.Graph) error

Save implements 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.

func (*Neo4jStore) Close

func (s *Neo4jStore) Close() error

Close implements Store.

func (*Neo4jStore) Load

func (s *Neo4jStore) Load(ctx context.Context, key string) (*graph.Graph, error)

Load implements Store.

func (*Neo4jStore) Name

func (s *Neo4jStore) Name() string

Name implements Store.

func (*Neo4jStore) Save

func (s *Neo4jStore) Save(ctx context.Context, key string, g *graph.Graph) error

Save implements Store.

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.

Jump to

Keyboard shortcuts

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