SimpleDataStore

Base class for JSON-based persistent data storage.

Declared in src/libs/libstore/store/SimpleDataStore.hpp
Inherits QEnableSharedFromThis
Inherited By AddressBook, AgentConfigStore, DirectorateBook, HiveRegistry, LLMRegistry, PlanBook, SentientRegistry, and SimpleMapStore
Group store

Detailed description

SimpleDataStore wraps AsyncStore with JSON backend for simple persistent storage. Subclasses implement toMap() and fromMap() to serialize their data. Supports async operations with callbacks.

See also AsyncStore, JsonAsyncBackend.

Member function documentation

close

bool SimpleDataStore::close()

Stop the worker, save the last changes and switch the store off.

It calls toMap() directly, on the calling thread, after the worker has ended. In a subclass destructor the frontend cannot reach the store any more: the last strong reference is gone, so its weak lock fails. So the events still queued that need the frontend fail, and this save writes the data they were for.

A deactivation that still waits for the event loop does nothing after this, see activate().

Returns false when the final save failed, and true otherwise, also when the store was not active.

In this section