Skip to main content

Crate flexpool_files

Crate flexpool_files 

Source
Expand description

flexpool’s local files, read the one way both binaries read them.

The domain crates are pure: they parse text and never open a file. This crate does the opening, for the daemon (flexpoold) and the command line (flexpool) alike, so neither binary depends on the other and the limits below exist once:

  • every read is bounded, even if the file grows after its size was checked;
  • a scenario’s data file is a relative path inside the scenario’s directory, symlinks included (market-replay/SR-003).

Constants§

MAX_JOURNAL_BYTES
Largest alarm journal read.
MAX_PORTFOLIO_BYTES
Largest portfolio file read.
MAX_SCENARIO_BYTES
Largest scenario or data file read.

Functions§

contained
Resolves a scenario’s data file inside the scenario’s directory (market-replay/SR-003).
fault_problems
A scenario’s faults that name an asset the portfolio does not hold.
load_portfolio
Reads and validates the portfolio in dir and its optional edge file, returning every problem.
load_scenario
Loads and validates a scenario file, collecting every problem (parse, data file, data).
read_capped_utf8
Reads at most cap bytes as UTF-8; a longer file is refused even if it grew after a size check (the read itself is bounded).
verify_journal
Checks an alarm journal’s hash chain without starting anything; the number of records.