package store import "axolotl/models" // GraphStore is a primitive graph persistence interface. It provides basic // operations for nodes and directed rels. No business logic lives here. // "Tag" rels are rels with an empty toID (e.g. "_type::issue" or "backend"). type GraphStore interface { // Nodes AddNode(id, title, content, dueDate, createdAt, updatedAt string) error GetNode(id string) (*models.Node, error) // returns node with tags and rels populated UpdateNode(id, title, content, dueDate, updatedAt string) error // empty dueDate stores NULL DeleteNode(id string) error NodeExists(id string) (bool, error) GenerateID() (string, error) // returns a random 5-char ID guaranteed unique in the store // Rels: relName is the relation name; toID is empty for "tag" rels (properties/labels). AddRel(nodeID, relName, toID string) error RemoveRel(nodeID, relName, toID string) error // FindNodes returns fully-populated nodes matching all given filters. // Filters with empty Target match nodes by rel_name prefix with empty toID (tag/property). // Filters with non-empty Target match nodes by exact rel_name and toID (edge). FindNodes(filters []*models.Rel) ([]*models.Node, error) // Transaction runs fn inside an atomic transaction. If fn returns an error // the transaction is rolled back; otherwise it is committed. // Calls to Transaction inside fn reuse the same transaction (no nesting). Transaction(fn func(GraphStore) error) error }