Publish and read
Desk contains eleven rings: intents, reports, quotes, algos, controls, pulses, prints, queries, pack_reqs, pack_rsps, and logs. Compile-time capacities track trade / package scale: kIntentCap/kReportCap/kAlgoCap 32768, kQuoteCap 8192, kControlCap 16384, kPulseCap/kPrintCap 4096, kQueryCap 1024, kPackReqCap/kLogCap 2048, kPackRspCap 16384. Soft capacity after desk_apply_conf / FanRing::tune is at most that size and is reported by capacity(). Cash and positions occupy cash (kCashCap 512) and hold (kHoldCap 4096).
publish takes the message and a reader mask. A mask of 0 means the first reader to acknowledge the slot claims it. Any other mask lists the readers that must acknowledge before the slot can be reused. Reader numbers are 0 through 63. The session loop is reader 7, kLoopReader.
pitlane::Intent in{};
in.tag = 1;
in.name = 1;
in.acct = 2;
in.px = 100;
in.qty = 5;
in.stamp_us = 1;
in.side = static_cast<uint8_t>(pitlane::Side::Buy);
in.act = static_cast<uint8_t>(pitlane::Act::Enter);
in.style = static_cast<uint8_t>(pitlane::Style::Day);
const uint64_t readers = 1ull << pitlane::kLoopReader;
if (!desk->intents.publish(in, readers)) {
// The ring is full. The new order was not stored.
}
A reader copies one slot with at. The position is absolute, starting at 0. fresh is true when this reader has not acknowledged it. ack records that acknowledgement. latest copies the newest published item. tail is the next position a writer will use.
pitlane::Intent got{};
bool fresh = false;
if (desk->intents.at(0, pitlane::kLoopReader, got, &fresh) && fresh) {
desk->intents.ack(0, pitlane::kLoopReader);
}
Intent, Report, and Quote are defined in desk/types.hpp. The other slot types — AlgoJob, ControlNote, Pulse, TapePrint, QueryNote, SubNote, SigNote, MktNote, PackageNote, and LogNote — are defined in desk/wire.hpp. A payload larger than those slots uses Parcel<Bytes> on a ring the caller owns. publish_parcel fails when the length is greater than Bytes. Hot path may desk_log_publish a LogNote; cold side drains the logs ring. WireLog is the process logger from the notes: log packs one PackedLine (literals via lit, dynamic strings copied, scalars memcpy'd) into a fixed fail-full ring and does not format. A background thread, or flush in caller mode, turns the slot into text. Put the file on tmpfs when the disk must stay off the hot path.