Skip to main content

Crate mockarchiver

Crate mockarchiver 

Source
Expand description

A mock EPICS Archiver Appliance for tests, CI and demos.

It serves deterministic synthetic history for a fixed set of PVs (see signals) with the real appliance’s wire format and quirks:

  • GET /retrieval/data/getData.json?pv=..&from=..&to=.. — raw (with the sample before from), optimized_N (raw when few samples, else [mean, std, min, max, count] bins at bin centres, filled), mean_N, min_N, max_N, std_N, variance_N, median_N, count_N, firstSample_N, lastSample_N, nth_N, ncount and the <op>Sample_N no-fill variants; op(PV,N) and pp= forms too; bare NaN tokens for MOCK:NAN; 404 (HTML body) for unknown PVs; 400 for a bad time, to < from or unbalanced parentheses. to defaults to now + 1h, from to to − 1 day. Summaries of strings and waveforms return raw data.
  • GET /retrieval/bpl/getMatchingPVs?pv=<glob>|regex=<re>&limit=N — the appliance’s naive glob (*→.*, ?→.), whole-name match, sorted; 404 with neither parameter.
  • GET /retrieval/bpl/getMetadata?pv=.. — DBRType, elementCount, units, precision, … as strings.
  • GET /retrieval/bpl/getVersion — {"version": "Archiver Appliance Version <mock version>"}.
  • GET /mgmt/bpl/getAllPVs?pv=<glob>[,<glob>]&regex=..&limit=N — unsorted.

Every endpoint is served on one port (like the single-container appliance), so --archiver http://127.0.0.1:PORT works for the client. Data begins signals::HISTORY_DAYS days before the server started and grows with the clock; large responses are streamed (chunked).

Modules§

signals
The synthetic PVs: deterministic functions of time on a fixed sample grid.

Structs§

MockArchiver
A running mock appliance. Serves on background threads until dropped.

Constants§

DEFAULT_PORT
The appliance’s retrieval port, the default for the binary.