Coat Check Gear
The coatcheck gear functions as the Asymmetric Bus Driver of the fluxrig mixer. It implements a high-speed Context Correlation engine that allows the system to remain stateless at the edge while preserving complex transaction context (session IDs, PCI tokens, tracing headers) across asynchronous boundaries.
By "Checking in" session state to a distributed cache, fluxrig resolves the Asymmetric Bus Scaling problem, enabling horizontal scalability where requests can exit via one Rack and responses can return via another.
| Attribute | Details |
|---|---|
| Type | coatcheck |
| Analogy | State Cache / Patch Memory |
| Status | Stable (v0.4.3) |
| Source Code | pkg/gears/native/coatcheck |
| Tech Stack | NATS JetStream (KV) |
| Pattern | Claim Check EIP |
| Port IN | Arbitrary fluxMsg |
| Port IN Cardinality | Single |
| Port OUT | Arbitrary fluxMsg |
| Port OUT Cardinality | Multiple (out, error) |
| Mandatory Consumed Metadata | [key_fields] (The Ticket) |
| Optional Consumed Metadata | meta.coatcheck.ttl |
| Signals Sent | flux.event.timeout (Metadata type) |
Architectural Signal Path
In fluxrig, the "Coat Check" is a virtual state room shared across the entire mesh. It uses the Message Flow Architecture to decouple identity from transport.
Operational Modes
The gear behaves as a specialized processor depending on its configured mode:
Mode: store (Check-In)
Role: Saves context before sending a message to a stateless transport.
- Extracts
key_fields(Correlation Key) andvalue_fields(Context Blob). - Key Generation: The extracted key fields are joined and encoded using URL-Safe Base64 (
base64.RawURLEncoding). - Saves the blob to the persistent NATS KV
bucketwith attl. - Forwards the original message unmodified to the
outport.