20inline constexpr std::string_view
kNoBackend =
"none";
36 return "already present";
54 [[nodiscard]]
const StoreEntry*
find(std::string_view name)
const noexcept;
55 [[nodiscard]]
const std::vector<StoreEntry>&
entries() const noexcept {
return entries_; }
57 [[nodiscard]] std::string
names()
const;
59 [[nodiscard]] std::unique_ptr<Backend>
make_backend(std::string_view name)
const;
60 [[nodiscard]] std::unique_ptr<Reader>
make_reader(std::string_view name)
const;
63 std::vector<StoreEntry> entries_;
Storage backend interface: what a session's fills, orders, positions, PnL and kill events are handed ...
Definition registry.hpp:47
const StoreEntry * find(std::string_view name) const noexcept
const std::vector< StoreEntry > & entries() const noexcept
Definition registry.hpp:57
std::unique_ptr< Backend > make_backend(std::string_view name) const
Null when name is unknown or, for make_reader, when the backend cannot be queried.
static StoreRegistry & instance()
The registry fastmm-live and fastmm-pnl use.
AddResult add(std::string_view name, StoreEntry::BackendFactory backend, StoreEntry::ReaderFactory reader=nullptr)
std::string names() const
Comma-separated names, for an error message; always starts with "none".
std::unique_ptr< Reader > make_reader(std::string_view name) const
Definition backend.hpp:39
std::string configured_backend(const GenericSection &storage)
[storage] backend, defaulting to "sqlite"; "none" disables the store.
AddResult
Definition registry.hpp:32
constexpr std::string_view to_string(AddResult r) noexcept
Definition registry.hpp:33
constexpr std::string_view kNoBackend
Definition registry.hpp:22
void register_builtin_backends(StoreRegistry &r=StoreRegistry::instance())
Adds the backends FastMM ships ("sqlite"). Idempotent.
Query side of a storage backend: what fastmm-pnl and a restarting session read back.
Free-form section used by the sim / backtest libraries: dotted keys -> stringified value.
Definition config.hpp:287
Definition registry.hpp:24
std::unique_ptr< Backend >(*)() BackendFactory
Definition registry.hpp:25
std::string name
Definition registry.hpp:27
BackendFactory backend
Definition registry.hpp:28
std::unique_ptr< Reader >(*)() ReaderFactory
Definition registry.hpp:26
ReaderFactory reader
null: the backend records but cannot be queried in process
Definition registry.hpp:29