20namespace neograph::graph {
51 virtual ~Store() =
default;
59 virtual void put(
const Namespace& ns,
const std::string& key,
const json& value) = 0;
67 virtual std::optional<StoreItem>
get(
const Namespace& ns,
const std::string& key)
const = 0;
75 virtual std::vector<StoreItem>
search(
const Namespace& ns_prefix,
int limit = 100)
const = 0;
100 void put(
const Namespace& ns,
const std::string& key,
const json& value)
override;
101 std::optional<StoreItem>
get(
const Namespace& ns,
const std::string& key)
const override;
102 std::vector<StoreItem>
search(
const Namespace& ns_prefix,
int limit = 100)
const override;
113 static std::string make_key(
const Namespace& ns,
const std::string& key);
114 static std::string ns_to_string(
const Namespace& ns);
115 static bool starts_with(
const std::string& str,
const std::string& prefix);
117 mutable std::mutex mutex_;
118 std::map<std::string, StoreItem> items_;
NEOGRAPH_API export/import macro for shared-library builds.
In-memory store implementation for testing and single-process use.
std::vector< StoreItem > search(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.
std::optional< StoreItem > get(const Namespace &ns, const std::string &key) const override
Retrieve a single item.
std::vector< Namespace > list_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).
void delete_item(const Namespace &ns, const std::string &key) override
Delete a single item.
Abstract interface for cross-thread shared memory.
virtual void delete_item(const Namespace &ns, const std::string &key)=0
Delete a single item.
virtual void put(const Namespace &ns, const std::string &key, const json &value)=0
Store a value (create or update).
virtual std::vector< Namespace > list_namespaces(const Namespace &prefix={}) const =0
List all namespaces under a prefix.
virtual std::vector< StoreItem > search(const Namespace &ns_prefix, int limit=100) const =0
Search items under a namespace prefix.
virtual std::optional< StoreItem > get(const Namespace &ns, const std::string &key) const =0
Retrieve a single item.
std::vector< std::string > Namespace
Hierarchical namespace path for store items.
A single item stored in the cross-thread Store.
int64_t updated_at
Last update timestamp (Unix epoch milliseconds).
std::string key
Item key within the namespace.
Namespace ns
Hierarchical namespace path.
json value
Stored JSON value.
int64_t created_at
Creation timestamp (Unix epoch milliseconds).
Foundation types for NeoGraph: messages, tool calls, and LLM completions.