Arachne 1.0
Arachne - the perpetual stitcher of Wikidata entities.
Loading...
Searching...
No Matches
arachne::coordination::operational_ledger::implementation Struct Reference

Public Member Functions

 implementation (const std::filesystem::path &path)
 implementation (const std::filesystem::path &path)

Public Attributes

sqlite_handle database

Detailed Description

Definition at line 394 of file coordinator.cpp.

Constructor & Destructor Documentation

◆ implementation() [1/2]

arachne::coordination::operational_ledger::implementation::implementation ( const std::filesystem::path & path)
inlineexplicit

Definition at line 395 of file coordinator.cpp.

396 : database(nullptr, sqlite3_close) {
397 sqlite3* raw = nullptr;
398 if (sqlite3_open_v2(
399 path.string().c_str(), &raw,
400 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
401 | SQLITE_OPEN_FULLMUTEX,
402 nullptr
403 )
404 != SQLITE_OK) {
405 const std::string message = raw != nullptr
406 ? sqlite3_errmsg(raw)
407 : "cannot open operational ledger";
408 if (raw != nullptr) {
409 sqlite3_close(raw);
410 }
411 throw std::runtime_error(message);
412 }
413 database.reset(raw);
414 if (sqlite3_busy_timeout(database.get(), 5000) != SQLITE_OK) {
416 database.get(), "configure operational-ledger timeout"
417 );
418 }
419 execute(database.get(), "PRAGMA foreign_keys = ON;");
420 execute(database.get(), "PRAGMA journal_mode = WAL;");
421 execute(database.get(), "PRAGMA synchronous = NORMAL;");
422 execute(database.get(), R"SQL(
423CREATE TABLE IF NOT EXISTS envelopes (
const std::filesystem::path & path() const noexcept
void throw_sqlite(sqlite3 *database, std::string_view context)
void execute(sqlite3 *database, std::string_view sql)

References implementation().

Referenced by implementation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ implementation() [2/2]

arachne::coordination::operational_ledger::implementation::implementation ( const std::filesystem::path & path)
inlineexplicit

Definition at line 395 of file coordinator.cpp.

396 : database(nullptr, sqlite3_close) {
397 sqlite3* raw = nullptr;
398 if (sqlite3_open_v2(
399 path.string().c_str(), &raw,
400 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
401 | SQLITE_OPEN_FULLMUTEX,
402 nullptr
403 )
404 != SQLITE_OK) {
405 const std::string message = raw != nullptr
406 ? sqlite3_errmsg(raw)
407 : "cannot open operational ledger";
408 if (raw != nullptr) {
409 sqlite3_close(raw);
410 }
411 throw std::runtime_error(message);
412 }
413 database.reset(raw);
414 if (sqlite3_busy_timeout(database.get(), 5000) != SQLITE_OK) {
416 database.get(), "configure operational-ledger timeout"
417 );
418 }
419 execute(database.get(), "PRAGMA foreign_keys = ON;");
420 execute(database.get(), "PRAGMA journal_mode = WAL;");
421 execute(database.get(), "PRAGMA synchronous = NORMAL;");
422 execute(database.get(), R"SQL(
423CREATE TABLE IF NOT EXISTS envelopes (

Member Data Documentation

◆ database

sqlite_handle arachne::coordination::operational_ledger::implementation::database

Definition at line 425 of file coordinator.cpp.


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