#include <file_backend.hpp>
|
| | ~FileBackend () override |
| |
| 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.
|
| |
| auto | reader (IdPredicate read_scope={}) -> expected< std::unique_ptr< RecordBackend::Reader >, BackendError > override |
| | Construct a Reader scoped to records whose id satisfies in_scope.
|
| |
| auto | finalize () -> expected< void, std::vector< BackendError > > override |
| | Lifecycle hook for cross-event cleanup: close process-level open handles, drain async queues, surface deferred errors.
|
| |
| const std::string & | path () const noexcept |
| | Path the backend was constructed against.
|
| |
| template<typename F > |
| auto | with_writer (std::chrono::system_clock::time_point epoch, Durability durability, F &&fn) -> expected< void, BackendError > |
| | Run fn inside a scoped Writer; calls commit() automatically on success.
|
| |
| template<typename F > |
| auto | with_reader (IdPredicate in_scope, F &&fn) -> expected< void, BackendError > |
| | Run fn inside a scoped Reader; calls close() automatically on success.
|
| |
◆ ~FileBackend()
| ngen::serialization::FileBackend::~FileBackend |
( |
| ) |
|
|
override |
◆ FileBackend()
| ngen::serialization::FileBackend::FileBackend |
( |
std::string | path, |
|
|
IdPredicate | initial_scope ) |
|
private |
◆ build_index_locked_()
| auto ngen::serialization::FileBackend::build_index_locked_ |
( |
| ) |
-> expected<void, BackendError> |
|
private |
◆ create()
| auto ngen::serialization::FileBackend::create |
( |
std::string | path, |
|
|
IdPredicate | index_scope = {} ) -> std::shared_ptr<FileBackend> |
|
staticnodiscard |
◆ ensure_write_fd_locked_()
| auto ngen::serialization::FileBackend::ensure_write_fd_locked_ |
( |
| ) |
-> expected<void, BackendError> |
|
private |
◆ finalize()
| auto ngen::serialization::FileBackend::finalize |
( |
| ) |
-> expected< void, std::vector< BackendError > > |
|
nodiscardoverridevirtual |
Lifecycle hook for cross-event cleanup: close process-level open handles, drain async queues, surface deferred errors.
Engine calls this at MPI synchronization points or before shutdown.
Error arm carries the vector of every BackendError accumulated since the last finalize() call — typically those deferred under Durability::relaxed from earlier write()/commit() calls, or any errors that surfaced during finalize itself. Each entry keeps its own structured Kind and message, so callers can branch per-error:
if (auto r = backend->finalize(); !r) {
for (const auto& e : r.error()) {
switch (e.kind) {
case BackendError::Kind::IOError: ...
case BackendError::Kind::Corrupted: ...
case BackendError::Kind::NotFound: ...
}
}
}
An empty deferred-error set is success — the success arm is returned, not an error arm with an empty vector.
Implements ngen::serialization::RecordBackend.
◆ path()
| const std::string & ngen::serialization::FileBackend::path |
( |
| ) |
const |
|
inlinenoexcept |
◆ reader()
Construct a Reader scoped to records whose id satisfies in_scope.
The predicate is both a hint and an enforced scope — out-of-scope ids return Kind::NotFound. An empty predicate means "no scope" — the Reader will find any record.
Implements ngen::serialization::RecordBackend.
◆ register_scope_()
| void ngen::serialization::FileBackend::register_scope_ |
( |
IdPredicate | scope | ) |
|
|
private |
◆ with_reader()
template<typename F >
| auto ngen::serialization::RecordBackend::with_reader |
( |
IdPredicate | in_scope, |
|
|
F && | fn ) -> expected<void, BackendError>
|
|
inlinenodiscardinherited |
◆ with_writer()
template<typename F >
| auto ngen::serialization::RecordBackend::with_writer |
( |
std::chrono::system_clock::time_point | epoch, |
|
|
Durability | durability, |
|
|
F && | fn ) -> expected<void, BackendError>
|
|
inlinenodiscardinherited |
◆ writer()
◆ deferred_errors_
| std::vector<BackendError> ngen::serialization::FileBackend::deferred_errors_ |
|
private |
◆ dirty_
| bool ngen::serialization::FileBackend::dirty_ = false |
|
private |
◆ fd_
| int ngen::serialization::FileBackend::fd_ = -1 |
|
private |
◆ index_
| std::shared_ptr<const Index> ngen::serialization::FileBackend::index_ |
|
private |
◆ index_built_
| bool ngen::serialization::FileBackend::index_built_ = false |
|
private |
◆ index_scope_
| IdPredicate ngen::serialization::FileBackend::index_scope_ |
|
private |
◆ io_mutex_
| std::mutex ngen::serialization::FileBackend::io_mutex_ |
|
mutableprivate |
◆ path_
| const std::string ngen::serialization::FileBackend::path_ |
|
private |
◆ registry_
| std::unordered_map< std::string, std::weak_ptr< FileBackend > > ngen::serialization::FileBackend::registry_ |
|
staticprivate |
◆ registry_mutex_
| std::mutex ngen::serialization::FileBackend::registry_mutex_ |
|
staticprivate |
The documentation for this class was generated from the following files: