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

In-memory store implementation for testing and single-process use. More...

#include <store.h>

Inheritance diagram for neograph::graph::InMemoryStore:
[legend]
Collaboration diagram for neograph::graph::InMemoryStore:
[legend]

Public Member Functions

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

Detailed Description

In-memory store implementation for testing and single-process use.

Thread-safe via mutex. Items are stored in a std::map keyed by a composite string of namespace + key.

Definition at line 98 of file store.h.

Member Function Documentation

◆ delete_item()

void neograph::graph::InMemoryStore::delete_item ( const Namespace ns,
const std::string &  key 
)
overridevirtual

Delete a single item.

Parameters
nsNamespace path.
keyItem key to delete.

Implements neograph::graph::Store.

◆ get()

std::optional< StoreItem > neograph::graph::InMemoryStore::get ( const Namespace ns,
const std::string &  key 
) const
overridevirtual

Retrieve a single item.

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

Implements neograph::graph::Store.

◆ list_namespaces()

std::vector< Namespace > neograph::graph::InMemoryStore::list_namespaces ( const Namespace prefix = {}) const
overridevirtual

List all namespaces under a prefix.

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

Implements neograph::graph::Store.

◆ put()

void neograph::graph::InMemoryStore::put ( const Namespace ns,
const std::string &  key,
const json &  value 
)
overridevirtual

Store a value (create or update).

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

Implements neograph::graph::Store.

◆ search()

std::vector< StoreItem > neograph::graph::InMemoryStore::search ( const Namespace ns_prefix,
int  limit = 100 
) const
overridevirtual

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.

Implements neograph::graph::Store.

◆ size()

size_t neograph::graph::InMemoryStore::size ( ) const

Get the total number of stored items.

Returns
Total item count.

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