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

Show on the map →

Called by SCENARIO, TEST_CASE

Calls none

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
lines 67–67◇ if (!handle)lines 67–67return ENTROPIC_ERROR_INVALID_HANDLE;lines 68–68handle->storage.reset();lines 69–69logger->info("storage_close");lines 70–70return ENTROPIC_OK;
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

Show on the map →

Called by SCENARIO

Calls none

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
lines 67–67◇ if (!handle)lines 67–67return ENTROPIC_ERROR_INVALID_HANDLE;lines 68–68handle->storage.reset();lines 69–69logger->info("storage_close");lines 70–70return ENTROPIC_OK;

Requirements

REQ-API-005 REQ-STOR-001

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

Show on the map →

Called by SCENARIO, SCENARIO, TEST_CASE

Calls none

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
lines 36–36◇ if (!handle || !db_path)lines 37–38return !handle ? ENTROPIC_ERROR_INVALID_HANDLE : ENTROPIC_ERROR_INVALID_ARGUMENT;lines 41–53try { 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; }
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

Show on the map →

Called by SCENARIO, SCENARIO, TEST_CASE

Calls SqliteStorageBackend, initialize

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
lines 36–36◇ if (!handle || !db_path)lines 37–38return !handle ? ENTROPIC_ERROR_INVALID_HANDLE : ENTROPIC_ERROR_INVALID_ARGUMENT;lines 41–53try { 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; }

Requirements

REQ-ABI-002 REQ-API-005 REQ-STOR-001