164#include "utilities/serialization/record_backend.hpp"
170#include <unordered_map>
173namespace serialization {
177 ,
public std::enable_shared_from_this<FileBackend> {
190 -> std::shared_ptr<FileBackend>;
197 auto writer(std::chrono::system_clock::time_point epoch,
Durability durability)
198 -> expected<std::unique_ptr<RecordBackend::Writer>,
BackendError>
override;
202 -> expected<std::unique_ptr<RecordBackend::Reader>,
BackendError>
override;
205 auto finalize() -> expected<void, std::vector<BackendError>>
override;
210 const std::string&
path() const noexcept {
289 static std::unordered_map<std::string, std::weak_ptr<FileBackend>>
registry_;
Definition file_backend.hpp:177
auto finalize() -> expected< void, std::vector< BackendError > > override
Lifecycle hook for cross-event cleanup: close process-level open handles, drain async queues,...
Definition file_backend.cpp:645
std::mutex io_mutex_
Definition file_backend.hpp:269
void register_scope_(IdPredicate scope)
Definition file_backend.cpp:546
static std::unordered_map< std::string, std::weak_ptr< FileBackend > > registry_
Definition file_backend.hpp:289
std::shared_ptr< const Index > index_
Definition file_backend.hpp:258
bool index_built_
Definition file_backend.hpp:255
auto writer(std::chrono::system_clock::time_point epoch, Durability durability) -> expected< std::unique_ptr< RecordBackend::Writer >, BackendError > override
Construct a Writer for one checkpoint event.
Definition file_backend.cpp:602
~FileBackend() override
Definition file_backend.cpp:560
int fd_
Definition file_backend.hpp:263
auto ensure_write_fd_locked_() -> expected< void, BackendError >
Definition file_backend.cpp:580
static std::mutex registry_mutex_
Definition file_backend.hpp:288
auto build_index_locked_() -> expected< void, BackendError >
Definition file_backend.cpp:569
auto reader(IdPredicate read_scope={}) -> expected< std::unique_ptr< RecordBackend::Reader >, BackendError > override
Construct a Reader scoped to records whose id satisfies in_scope.
Definition file_backend.cpp:618
FileBackend(std::string path, IdPredicate initial_scope)
Definition file_backend.cpp:541
const std::string path_
Definition file_backend.hpp:247
const std::string & path() const noexcept
Path the backend was constructed against.
Definition file_backend.hpp:210
bool dirty_
Definition file_backend.hpp:275
static auto create(std::string path, IdPredicate index_scope={}) -> std::shared_ptr< FileBackend >
Get-or-create a shared_ptr-managed FileBackend at path.
Definition file_backend.cpp:506
IdPredicate index_scope_
Definition file_backend.hpp:251
std::vector< BackendError > deferred_errors_
Definition file_backend.hpp:279
Abstract storage interface for Records.
Definition record_backend.hpp:83
std::function< bool(const std::string &id)> IdPredicate
Eligibility predicate over a SerializationRecord's id string.
Definition id_predicates.hpp:56
Durability
Save-time durability requirement.
Definition record_backend.hpp:59
Definition DomainLayer.hpp:13
Categorized error carried on every abstract-backend method's expected<> error arm.
Definition record_backend.hpp:70