entropic_storage.cpp¶
src/facade/entropic_storage.cpp
@file entropic_storage.cpp @brief C API facade for storage open/close.
Owners: @tvanfossen
entropic_storage_close
ENTROPIC_EXPORT entropic_error_t entropic_storage_close(entropic_handle_t handle)
Close the storage backend.
src/facade/entropic_storage.cpp:66
Source · 6 lines
entropic_storage_close(entropic_handle_t handle) {
if (!handle) { return ENTROPIC_ERROR_INVALID_HANDLE; }
handle->storage.reset();
logger->info("storage_close");
return ENTROPIC_OK;
}Activity · 5 steps
ENTROPIC_EXPORT entropic_error_t entropic_storage_close(entropic_handle_t handle)
Close the storage backend and flush pending writes.
src/facade/entropic_storage.cpp:66
Source · 6 lines
entropic_storage_close(entropic_handle_t handle) {
if (!handle) { return ENTROPIC_ERROR_INVALID_HANDLE; }
handle->storage.reset();
logger->info("storage_close");
return ENTROPIC_OK;
}Activity · 5 steps
Requirements
entropic_storage_open
ENTROPIC_EXPORT entropic_error_t entropic_storage_open(entropic_handle_t handle, const char *db_path)
Open or create a SQLite storage backend.
src/facade/entropic_storage.cpp:32
Source · 23 lines
entropic_storage_open(
entropic_handle_t handle,
const char* db_path) {
if (!handle || !db_path) {
return !handle ? ENTROPIC_ERROR_INVALID_HANDLE
: ENTROPIC_ERROR_INVALID_ARGUMENT;
}
try {
handle->storage = std::make_unique<entropic::SqliteStorageBackend>(db_path);
if (!handle->storage->initialize()) {
handle->storage.reset();
throw std::runtime_error("SQLite init failed");
}
logger->info("storage_open: path='{}'", db_path);
return ENTROPIC_OK;
} catch (const std::exception& e) {
handle->last_error = e.what();
logger->error("storage_open: {}", handle->last_error);
return ENTROPIC_ERROR_STORAGE_FAILED;
}
}Activity · 3 steps
ENTROPIC_EXPORT entropic_error_t entropic_storage_open(entropic_handle_t handle, const char *db_path)
Open or create a SQLite storage backend.
src/facade/entropic_storage.cpp:32
Source · 23 lines
entropic_storage_open(
entropic_handle_t handle,
const char* db_path) {
if (!handle || !db_path) {
return !handle ? ENTROPIC_ERROR_INVALID_HANDLE
: ENTROPIC_ERROR_INVALID_ARGUMENT;
}
try {
handle->storage = std::make_unique<entropic::SqliteStorageBackend>(db_path);
if (!handle->storage->initialize()) {
handle->storage.reset();
throw std::runtime_error("SQLite init failed");
}
logger->info("storage_open: path='{}'", db_path);
return ENTROPIC_OK;
} catch (const std::exception& e) {
handle->last_error = e.what();
logger->error("storage_open: {}", handle->last_error);
return ENTROPIC_ERROR_STORAGE_FAILED;
}
}