NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
neograph::graph::Store Class Referenceabstract

Abstract interface for cross-thread shared memory. More...

#include <store.h>

Inheritance diagram for neograph::graph::Store:
[legend]

Public Member Functions

virtual void delete_item (const Namespace &ns, const std::string &key)=0
 Delete a single item.
 
virtual std::optional< StoreItemget (const Namespace &ns, const std::string &key) const =0
 Retrieve a single item.
 
virtual std::vector< Namespacelist_namespaces (const Namespace &prefix={}) const =0
 List all namespaces under a prefix.
 
virtual void put (const Namespace &ns, const std::string &key, const json &value)=0
 Store a value (create or update).
 
virtual std::vector< StoreItemsearch (const Namespace &ns_prefix, int limit=100) const =0
 Search items under a namespace prefix.
 

Detailed Description

Abstract interface for cross-thread shared memory.

Provides namespaced key-value storage accessible from any graph thread. Implement this to use databases or other persistence backends.

See also
InMemoryStore for a reference implementation.

Definition at line 49 of file store.h.

Member Function Documentation

◆ delete_item()

virtual void neograph::graph::Store::delete_item ( const Namespace ns,
const std::string &  key 
)
pure virtual

Delete a single item.

Parameters
nsNamespace path.
keyItem key to delete.

Implemented in neograph::graph::InMemoryStore.

◆ get()

virtual std::optional< StoreItem > neograph::graph::Store::get ( const Namespace ns,
const std::string &  key 
) const
pure virtual

Retrieve a single item.

Parameters
nsNamespace path.
keyItem key.
Returns
The item, or std::nullopt if not found.

Implemented in neograph::graph::InMemoryStore.

◆ list_namespaces()

virtual std::vector< Namespace > neograph::graph::Store::list_namespaces ( const Namespace prefix = {}) const
pure virtual

List all namespaces under a prefix.

Parameters
prefixNamespace prefix to filter by (empty = list all).
Returns
Vector of unique Namespace paths.

Implemented in neograph::graph::InMemoryStore.

◆ put()

virtual void neograph::graph::Store::put ( const Namespace ns,
const std::string &  key,
const json &  value 
)
pure virtual

Store a value (create or update).

Parameters
nsNamespace path for the item.
keyItem key within the namespace.
valueJSON value to store.

Implemented in neograph::graph::InMemoryStore.

◆ search()

virtual std::vector< StoreItem > neograph::graph::Store::search ( const Namespace ns_prefix,
int  limit = 100 
) const
pure virtual

Search items under a namespace prefix.

Parameters
ns_prefixNamespace prefix to match (e.g., {"users"} matches all user items).
limitMaximum number of items to return (default: 100).
Returns
Vector of matching StoreItem objects.

Implemented in neograph::graph::InMemoryStore.


The documentation for this class was generated from the following file: