NGen
Loading...
Searching...
No Matches
ngen::serialization::FileBackend::Index Class Reference
+ Collaboration diagram for ngen::serialization::FileBackend::Index:

Classes

struct  Entry
 

Public Member Functions

boost::optional< const Entry & > find_latest (const std::string &id) const
 
boost::optional< const Entry & > find_at_step (const std::string &id, int64_t step) const
 
boost::optional< const Entry & > find_at_simulation_timestamp (const std::string &id, int64_t simulation_timestamp) const
 
std::size_t size () const noexcept
 
 Index ()=default
 

Static Public Member Functions

static auto build (const std::string &path, const IdPredicate &index_scope) -> expected< std::shared_ptr< const Index >, BackendError >
 Walk path and build an index of records whose id satisfies index_scope.
 

Private Member Functions

void insert_or_replace (std::string id, const Entry &entry, const std::string &path)
 

Private Attributes

std::unordered_map< std::string, std::vector< Entry > > by_id_
 

Constructor & Destructor Documentation

◆ Index()

ngen::serialization::FileBackend::Index::Index ( )
default

Member Function Documentation

◆ build()

static auto ngen::serialization::FileBackend::Index::build ( const std::string & path,
const IdPredicate & index_scope ) -> expected<std::shared_ptr<const Index>, BackendError>
inlinestatic

Walk path and build an index of records whose id satisfies index_scope.

An empty predicate means "index everything." Returns a non-null shared_ptr<const Index> on success; the IOError arm fires only on stream-open failure of a kind that isn't "file doesn't exist" (missing-file yields an empty index — a valid outcome that pairs with NotFound on every Reader lookup).

References models::bmi::protocols::serialization::wire_format::RecordPrefix::checkpoint_epoch, ngen::serialization::FileBackend::path(), models::bmi::protocols::read_record_metadata(), models::bmi::protocols::serialization::wire_format::RecordPrefix::simulation_timestamp, and models::bmi::protocols::serialization::wire_format::RecordPrefix::time_step.

◆ find_at_simulation_timestamp()

boost::optional< const Entry & > ngen::serialization::FileBackend::Index::find_at_simulation_timestamp ( const std::string & id,
int64_t simulation_timestamp ) const
inline

References by_id_.

◆ find_at_step()

boost::optional< const Entry & > ngen::serialization::FileBackend::Index::find_at_step ( const std::string & id,
int64_t step ) const
inline

References by_id_.

◆ find_latest()

boost::optional< const Entry & > ngen::serialization::FileBackend::Index::find_latest ( const std::string & id) const
inline

References by_id_.

◆ insert_or_replace()

void ngen::serialization::FileBackend::Index::insert_or_replace ( std::string id,
const Entry & entry,
const std::string & path )
inlineprivate

◆ size()

std::size_t ngen::serialization::FileBackend::Index::size ( ) const
inlinenoexcept

References by_id_.

Member Data Documentation

◆ by_id_

std::unordered_map<std::string, std::vector<Entry> > ngen::serialization::FileBackend::Index::by_id_
private

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