Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Record types

✅ Verified · no code on this page · docs-verify

The badge reports the whole docs-verify suite, not this chapter alone.

RecordType has seventeen variants (spvirit-server/src/types.rs:24). Not all seventeen are reachable by every route: the handle API, the server builder, and .db loading each cover a different subset. This page is that matrix, checked against the constructors that actually exist.

If you are not sure whether you want a record at all, read Records vs raw NT first.

The matrix

RecordEPICS meaningHandle APIBuilder.dbWritable
aianalog inPv::ai.ai()record(ai, …)no¹
aoanalog outPv::ao.ao()record(ao, …)yes
bibinary inPv::bi.bi()record(bi, …)no
bobinary outPv::bo.bo()record(bo, …)yes
longin32-bit integer inPv::longin——no
longout32-bit integer outPv::longout——yes
stringinstring inPv::string_in.string_in()record(stringin, …)no
stringoutstring outPv::string_out.string_out()record(stringout, …)yes
mbbimulti-bit binary inPv::mbbi.mbbi()parses, then refused²no
mbbomulti-bit binary outPv::mbbo.mbbo()parses, then refused²yes³
waveformarrayPvArray::waveform.waveform()record(waveform, …)yes
aaiarray analog inPvArray::aai.aai()record(aai, …)no
aaoarray analog outPvArray::aao.aao()record(aao, …)yes
subArraywindow onto an array—.sub_array()record(subarray, …)no
NtTabletable payload—.nt_table()refused²yes⁴
NtNdArrayimage / detector frame—.nt_ndarray()refused²yes⁴
Genericarbitrary structure—.generic()refused²yes⁵

¹ An ai becomes writable when SIMM is set — the simulation-mode path (spvirit-server/src/types.rs:359).

² RecordType::from_db_name recognises thirteen .db spellings (twelve record types, with mbbi also accepted as ntenum), including mbbi and mbbo. The .db loader does not construct those two yet: loading a file that contains one fails with "record '…' of type 'mbbi' is not yet supported by the .db loader; create it through the host API instead". See Known gaps.

³ A wire PUT selects the choice by index ({"value":{"index":2}}); an out-of-range index is refused with a PUT error.

⁴ The NtTable arm of RecordInstance::apply_put_fields (spvirit-server/src/apply.rs:675) applies the wire fields, and apply_put restamps the record. An NtNdArray PUT applies the metadata fields, but the image value a client sends is not applied (see Known gaps). Both are writable through store.put_nt() too.

⁵ Writable through store.put_nt() only. A client PUT to a generic record is refused with a PUT error — see Known gaps.

Reading the columns

Handle API — Pv<T> and PvArray constructors in spvirit-server/src/pv.rs. These give you a handle you keep after the server starts, so you can set(), scan(), calc() and on_put() on it. This is the level most of Part III works at.

Builder — PvaServer::builder().ai(…) and friends (spvirit-server/src/pva_server.rs). Declares records inline; you reach them afterwards through the store rather than through a handle. The builder is the only declare-up-front route to nt_table, nt_ndarray and generic (subArray also loads from .db, and PvaServer::add_table adds a table at runtime).

.db — text database files, as EPICS Base uses them. See Serving a .db file for the fields spvirit acts on.

Writable — whether the server grants write access (RecordInstance::writable, spvirit-server/src/types.rs:354). Output record types are always writable; a handful of input types are too, for the reasons in the footnotes. Everything else answers a PUT with Write access denied.

The derived record

Pv::calc (spvirit-server/src/pv.rs:392) is not a record type. It builds an ai whose value is recomputed from other Pv<f64> handles whenever one of them changes — the equivalent of a calc record's CALC expression, written as a Rust closure. The builder spelling is .link(output, inputs, compute).

Python

The Python module exposes the same handle-API set: ai, ao, bi, bo, string_in, string_out, longin, longout, mbbi, mbbo, waveform, aai, aao, calc, plus the generic pv and scalar constructors (spvirit-py/src/lib.rs:84). See Python API.