Expand description
A client for the EPICS Archiver Appliance retrieval API.
The pieces are split so that a browser build could reuse everything but
the HTTP: ArchiverClient builds the request URLs (*_url), the
parse_* functions decode the bodies, and the blocking
get_data/search/metadata methods do both over ureq on native
targets. In a browser those methods fail at once.
Times are UTC seconds since the Unix epoch as f64 (sub-microsecond
resolution for current dates), the same as bobview’s trend and
archiveview’s plot.
See DESIGN.md at the repository root for the wire format and its
surprises (bare NaN tokens, string PREC, [ ] for no data, binned
[mean, std, min, max, count] values from optimized_N).
Structs§
- Archiver
Client - An Archiver Appliance retrieval service. Cheap to clone; holds no connection state, so it can be shared freely between threads and between several plots.
- Meta
- The
metaobject of a response, with the common fields decoded. Values may arrive as strings or numbers; both are accepted. - PvInfo
- What
getMetadatasays about a PV (all optional: servers differ). - Query
- A
getData.jsonrequest. - Sample
- One plotted point of archived data.
- Search
- A
getMatchingPVsrequest. - Time
Series - One PV’s archived data for a request.
Enums§
- Error
- Why a request failed.
- Operator
- Server-side processing for a data request.
- Search
Mode - How a search pattern is matched.
- Severity
- An archived alarm severity (the
severityfield: 0..=3). - Value
Kind - What the archived values were, as seen in the response.
Constants§
- DEFAULT_
SEARCH_ LIMIT - The default number of PV names a search asks for.
- MAX_
BINS - The most bins an
optimized_Nrequest asks for, whatever the plot width.
Functions§
- format_
time t(UTC epoch seconds) asYYYY-MM-DDTHH:MM:SS.mmmZ, rounded to the millisecond. Non-finite or out-of-range times are clamped to the epoch and to year 9999.- parse_
data - Decode a
getData.jsonbody: oneTimeSeriesper PV, empty for[ ]. Tolerates bareNaN/Infinity/-Infinity, string or numericPREC/LOPR/HOPR, unknown keys, andfieldsobjects. A severity-3 sample whosefieldsholdcnxlostepsecsbecomes aSample::gap. A 5-element arrayvalon a scalar PV is anoptimizedbin (binned = true); other arrays are waveforms (valholds element 0). - parse_
metadata - Decode a
getMetadatabody. - parse_
names - Decode a JSON array of PV names (
getMatchingPVs,getAllPVs). - parse_
time - An archiver timestamp (
Instant.parse/ ISO offset forms, e.g.2024-01-02T03:04:05.123Zor2024-01-02T03:04:05-07:00) as epoch seconds. - parse_
version - Decode a
getVersionbody:{"version": "..."}. - regex_
escape textwith every regex metacharacter backslash-escaped, so it matches itself (in Java’s regex syntax, which the appliance uses, and in Rust’s).- sanitize_
json - Replace the bare tokens
NaN,Infinityand-Infinityoutside strings withnull, soserde_jsonaccepts the body. Borrowed when there are none.