Expand description
NATS subject builders for LabJack live data and archive exports.
The streamer publishes each channelโs scans on a live subject, the archiver consumes the same subjects from local JetStream and writes Parquet, and the exporter listens on an export request subject. All of them build their subject names here so the layouts stay in one place.
Two layouts are supported:
- Legacy, keyed by asset number:
avenabox.<asset>.data.chNN, for exampleavenabox.1456.data.ch11. The root is used exactly as configured. - Structured, keyed by identity:
avenars.<site>.<box>.<source>.live.chNN, for exampleavenars.i69.i69-mu1.i69-lj2.live.ch11. Every token is passed throughsanitize_token.
The structured layout is chosen when the root is avenars or any of site, box or
source ID is set (see uses_structured_namespace).
Functionsยง
- archive_
export_ request_ subject - Builds the NATS request subject that the exporter serves archive exports on.
- live_
labjack_ channel_ subject - Builds the live-data subject for one LabJack channel.
- live_
labjack_ stream_ subject - Builds the JetStream subject wildcard for all live channels from one source.
- pad_
asset - Formats an asset number with the three-digit legacy subject width.
- pad_
channel - Formats a LabJack channel number as the
chNNtoken used in subjects. - present ๐
- Treats an empty identity field the same as a missing one.
- sanitize_
token ๐ - Converts arbitrary identity text into a single NATS subject token.
- source_
token ๐ - Picks the source token shared by every structured subject.
- stream_
subject_ is_ compatible - Checks whether an existing stream subject is compatible with a desired one.
- uses_
structured_ ๐namespace - Decides whether a config should use the structured subject namespace.