Skip to main content

Data model (fluxMsg)

This section details the specific wire formats (CBOR), field dictionaries, and entity identification that the fluxrig ecosystem uses.

The Mixer keeps the registry in a JetStream key-value bucket. See Identity & registry.

NOTE

For the conceptual architecture and philosophy behind these models, see the Architecture: Data Model guide.

Message specification (header spec)​

All messages traversing the bus MUST adhere to the Signal Metadata standard for context propagation.

Wire headers (transport level)​

The system uses these headers during message propagation across the NATS network or HTTP boundaries. Note: These are distinct from the internal Metadata map found within the payload body.

Header KeyStandardDescription
Nats-Msg-IdNATSUnique Message Deduplication ID.
TraceparentW3C OTelDistributed Tracing ID (00-{trace_id}-{span_id}-{flags}).

fluxMsg structure (payload)​

The payload is always a CBOR-encoded fluxMsg struct.

// fluxMsg is the atomic unit of data in the system.
type FluxMsg struct {
// --- Identity & Tracing ---
FluxID uuid.UUID `cbor:"id"` // Global Unique ID (UUID v7)
RefFluxID uuid.UUID `cbor:"ref_id"` // Correlation / Parent ID
TraceID string `cbor:"trace"` // OpenTelemetry trace_id (Hex)
SrcGearID uuid.UUID `cbor:"src_id"` // Originator EntityID

// --- Context (Metadata) ---
// Routing flags, source IP, protocol headers.
// Values MUST be valid UTF-8 strings.
Metadata map[string]string `cbor:"meta"`

// --- The Business Data ---
// Unified Field Map (ISO8583 tags, JSON keys).
Data map[string]any `cbor:"data"`

// --- Signaling ---
Flags uint32 `cbor:"flags"` // System-level signaling (e.g., 0x01 = Sync Probe)

// --- Fallback & Audit ---
RawPayload []byte `cbor:"raw"` // Original wire bytes
Path []*Hop `cbor:"path"` // Audit Trail
TsInit int64 `cbor:"ts"` // Timestamp of creation (Unix Nanos)
}
type Hop struct {
GearID uuid.UUID `cbor:"g"`
PortID uuid.UUID `cbor:"p"`
TsNano int64 `cbor:"t"`
}

Field dictionary​

FieldTypeTagDescription
FluxIDuuid.UUIDidGlobally unique transactional ID (UUID v7).
RefFluxIDuuid.UUIDref_idCorrelation ID (references a Parent signal).
TraceIDstringtraceW3C Otel Trace ID for distributed observability.
SrcGearIDuuid.UUIDsrc_idThe entity_id of the originating Gear.
Metadatamap[string]stringmetaSignal Metadata (Routing flags, protocol headers).
Datamap[string]anydataBusiness fields (ISO8583 tags, user-defined keys).
Flagsuint32flagsSystem-level signaling (e.g., 0x01 = Sync Probe).
RawPayload[]byterawThe original, bit-perfect wire bytes.
Path[]*HoppathThe hops a message took, for auditability. Recorded, not signed.
TsInitint64tsUnix Nanoseconds of entry into the Rig.

System signaling (flags)​

The Flags field is a 32-bit bitmask used for high-speed, system-level signaling that must be processed without parsing the business Data map.

BitHexNameDescription
00x01FlagSyncProbeData-Plane Sync: Used by the Relentless Handshake to verify data-plane availability.
1..31-ReservedReserved for future system orchestration signals.

Signal metadata dictionary​

To ensure interoperability across the fleet, fluxrig distinguishes between Industry Standard keys and project-specific internal keys.

W3C trace context (standard)​

These keys adhere strictly to the W3C Trace Context standard that OpenTelemetry uses. They use no-dot notation.

KeyDescriptionSource
traceparentW3C Trace Parent (00-{trace_id}-{span_id}-{flags}).Ingress / TCP I/O
tracestateW3C Trace State (vendor-specific trace data).Ingress / TCP I/O

fluxrig signal metadata​

Internal keys follow the Dot Notation convention (namespace.property).

KeyTypeDescriptionSource
conn.idHex StringUnique connection ID (Session) for routing responses.TCP I/O
fluxrig.sourceStringName/ID of the gear that emitted the message.Architecture
spec.idHex StringThe entity_id of the Spec used to parse this message.Codec Gear
peer.ipStringIP Address of the remote sender.TCP I/O
peer.portStringPort of the remote sender.TCP I/O
http.methodStringHTTP Method (GET, POST) if applicable.HTTP I/O
http.pathStringURL Path.HTTP I/O
iso8583.mtiStringMessage Type Indicator (e.g., "0200").Codec / IO (Heuristic)
iso8583.bitmapsStringCount of bitmaps present (e.g., "1", "2").Codec / IO (Heuristic)
iso8583.fieldsStringList of active fields (e.g., "[2, 3, 4]").Codec / IO (Heuristic)
iso8583.raw_headerHex StringPreserved raw framing header (Prefixed with hex:).ISO8583 I/O
iso8583.src_idStringRouting Header Source ID.ISO8583 I/O
iso8583.dst_idStringRouting Header Destination ID.ISO8583 I/O
conductor.originStringOrigin stamp for cross-Conductor response routing (out_response_<origin>).Conductor
coatcheck.ttlStringDuration Override (e.g., "5m", "120s").Coat Check
event.typeStringEvent ID (e.g., "flux.event.timeout").Coat Check
timeout.keyStringThe key that expired.Coat Check
timeout.bucketStringThe bucket where the key expired.Coat Check

Payments glossary (industry standard aliases)​

Coat Check, the Conductor, and the Correlator [Roadmap] function uniformly regardless of the underlying dialect. To ensure this, we enforce exact standard aliases in the Codec SDL.

Alias KeyTypeDescription
card.panStringPrimary Account Number (Often Field 2).
card.expStringExpiration Date (YYMM format).
routing.binStringThe Bank Identification Number (extrapolated or explicit).
amount.transactionStringThe nominal transaction amount. Kept as a String (with implied decimals, e.g., 000000010000 for 100.00) to strictly avoid floating-point errors.
trace.stanStringSystem Trace Audit Number (Often Field 11).
trace.rrnStringRetrieval Reference Number.

IMPORTANT

Metadata Integrity Guard To ensure cross-language interoperability and wire compatibility with CBOR (RFC 8949), all Metadata values MUST be UTF-8 compliant.

  • Binary Data: You must encode binary data in hex and prefix it with hex: (e.g., hex:4e62...).
  • Validation: The system will authoritatively reject messages containing non-UTF-8 metadata at the Bus boundary.

entity_id structure​

The entity_id identifies a persistent component (Rack, Gear, specific Spec Version). It uses a 128-bit UUID v7 structure that embeds technical hints: [ Timestamp (48) ] [ Version (4) ] [ Variant (2) ] [ EntityType (8) ] [ Machine ID Hint (32) ] [ Random (34) ]

Prefix (Hex)Entity TypeRelation to machine_id
0x00ReservedSystem Broadcast / Null
0x01ClusterPhysical infrastructure (HA cluster)
0x02MixerLogical tenant unit
0x03fluxMsgMessage Instance
0x04RackIncludes machine_id
0x05GearRackID + Local Index
0x06PortInputSink (Standard In)
0x07PortOutputSource (Standard Out)
0x08WireConnection between ports
0x09SnakeTransport Tunnel
0x0aScenarioConfig Definition
0x0bSessionRuntime Context
0x0cSpecVersionImmutable Spec Blob ID

Registry and identity mapping​

The Registry manages the machine_id allocations that make up the entity_id. To support clustering and observability, machine_ids are now 128-bit UUIDs.

Machine ID policy​

IdentityPersistenceAssignmentDescription
uuid.NilTransientDefaultRepresents a node without an assigned Identity (e.g., during initial handshake or offline mode).
UUID v7PermanentRegistryUnique identifier assigned to Mixers and Racks. Includes a 32-bit machine hint for log traceability.

Identity assignment strategy​

ComponentStrategyMechanismEntity Type
MixerPersistentConfiguration or Autonomous0x02
RackDynamicRegistry Assignment0x04
SnakeImplicitConnection0x09

Mixers use static assignment via configuration to ensure stable leadership. Racks receive their ID dynamically during enrollment. The Registry then embeds this ID into the entity_id (Type 0x04). Snakes (Type 0x09) represent the connection path (NATS Link) from a Rack to a Mixer. They inherit identity from their host.

Registry​

The Mixer keeps one record per Mixer, Rack and Snake in its registry bucket, keyed by type and machine_id, with a name index that keeps names unique. The type is 2 (Mixer), 4 (Rack) or 9 (Snake). Identity & registry describes the keys, the records and presence.

fluxMsg vs trace_id​

Before you read about distributed tracing concepts elsewhere, distinguish our two primary identifiers:

  • flux_id: The physical, unique pointer to the record in our internal data store (e.g., DuckDB, parquet). The system generates it with the UUID v7 standard for high-speed local issuance with time-ordering.
  • trace_id: It ties this flux_id to external systems outside the fluxrig boundary as a logical, distributed trace (opentelemetry/w3c).