Expand description
Pure decision logic for tatara-export-worker — the binary that
ships one declared ExportSpec from an ephemeral Process to its
Vector-native channel.
The compounding move: every function in this module is pure (no
HTTP, no NATS, no kube client, no clock), takes its inputs by
reference, and returns a typed value the I/O layer in main.rs
then consumes. That means the whole worker is unit-testable
without standing up infrastructure — and any new artifact source
or channel can be added by extending this module first, then the
I/O glue mechanically follows.
Three substrate primitives live here:
-
prepare_event_payload— given anArtifactVariant+ raw artifact bytes + run id + signal_type, produces the JSON event the channel will ship. Encoded once, shared by all channels. -
resolve_run_id/resolve_subject— string-template substitution for{{run_id}}in NATS subjects + event labels. Single source of truth so the worker, the reconciler, and any downstream cohort-correlation logic agree on what the run id means. -
compose_export_receipt— builds a typedReceiptEnvelopeof the export action itself, with the three BLAKE3 pillars derived from the ExportSpec (intent), the shipped payload bytes (artifact), and the outcome (control). The receipt chains into the Process’s attestation tree, so the act of exporting is itself attested.
The I/O glue in main.rs is thin — argv → ExportSpec → call
these functions → ship to channel → write receipt.
Structs§
- Export
Event - JSON event shape shipped through every
VectorChannel. Stable schema — shinryu’s analytical SQL plane reads from it directly.
Enums§
- Export
Outcome - Final state of the export action — feeds the
control_hashpillar of the typed receipt.
Functions§
- compose_
export_ receipt - Build a typed
ReceiptEnvelopeof the export action via the existingReceiptEnvelope::build()constructor (single source of truth for the three-pillar composition + BLAKE3 root). - prepare_
event_ payload - Build the JSON event the channel ships.
- resolve_
run_ id - Resolve the run id used in event labels + subject templates.
- resolve_
subject - Substitute
{{run_id}}placeholders in a NATS subject template. - run_
marker_ event - Convenience for the worker — calls the right run marker preparation when no artifact bytes exist (e.g. start/end markers the worker synthesizes itself).