MCPcopy Index your code
hub / github.com/brewlabshq/qlaster-public

github.com/brewlabshq/qlaster-public @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
212 symbols 491 edges 15 files 20 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Qlaster

Shared-memory data streaming for colocated Solana services.

Account, transaction, and slot updates are fanned out from a single sender to local consumers over a per-consumer SPSC ring in /dev/shm, with a Unix-domain control socket for handshake, subscription, and eventfd-based wakeups.

qlaster

Why

  • Zero-copy hot path. Updates land in mmap'd ring memory; consumers read in place. No socket copy, no serializer per consumer.
  • Filter at the sender. Per-consumer subscriptions (account pubkeys, owners, transaction opt-in) — large filters fall back to a bloom-pre-reject.
  • Backpressure-aware. A slow consumer that fills its ring is dropped rather than stalling the dispatcher.
  • Opportunistic LZ4 on account payloads ≥ 500 KiB when entropy sampling predicts a real win.

Layout

  • sender/ — binds the UDS, provisions a ring + eventfd per consumer, runs the dispatcher tasks fed by broadcast::Sender<AccountUpdate> / broadcast::Sender<TransactionUpdate> / broadcast::Sender<SlotUpdate>.
  • consumer/ — connects to the UDS, receives the ring path + eventfd via SCM_RIGHTS, drains frames into crossbeam_queue::ArrayQueues the caller polls.
  • shm/ — ring buffer, eventfd, UDS framing primitives.
  • types.rs, wire.rs — wire format and frame codecs.

Usage

use qlaster::sender::{SenderConfig, ShmTransportConfig, setup_sender};
use qlaster::consumer::setup_shm_consumer;
use qlaster::metrics::QlasterSenderMetrics;
use std::sync::Arc;
use tokio::sync::broadcast;

let (updates_tx, _) = broadcast::channel(128);
let cfg = SenderConfig { shm: ShmTransportConfig::defaults("/tmp/qlaster.sock") };
let sender = setup_sender(cfg, updates_tx.clone(), None, Arc::new(QlasterSenderMetrics::new())).await?;
tokio::spawn(sender.run());

let mut consumer = setup_shm_consumer("/tmp/qlaster.sock").await?;
consumer.subscribe(vec![pubkey], vec![]).await?;
while let Some(update) = consumer.updates.pop() { /* ... */ }

See tests/shm_flow.rs for end-to-end examples (account filtering, transaction opt-in, always-on slot updates, reconnection).

Requirements

Unix. Linux is the production target; macOS is supported for development.

  • Inter-process wakeups use eventfd(2) on Linux and a self-pipe on macOS (the sender holds the write end and hands the consumer the read end). Both are passed over SCM_RIGHTS.
  • The shared-memory ring is a regular mmap(MAP_SHARED) file — there is no memfd_create dependency. On Linux the default directory is the RAM-backed /dev/shm; on macOS it falls back to the platform temp dir (std::env::temp_dir()), which is APFS-backed, so ring latency on macOS is not representative of production.
  • SIGPIPE is suppressed per-send via MSG_NOSIGNAL on Linux and via the SO_NOSIGPIPE socket option on macOS.

Sender and consumer must run on the same host and share the shared-memory directory the sender chooses.

Build: edition 2024 (Rust 1.85+).

Core symbols most depended-on inside this repo

len
called by 67
src/types.rs
encode
called by 16
src/types.rs
flush
called by 14
src/metrics.rs
as_raw_fd
called by 13
src/shm/eventfd.rs
as_ref
called by 12
src/types.rs
record
called by 11
src/metrics.rs
encode_parts_at
called by 9
src/types.rs
take_u64_le
called by 9
src/types.rs

Shape

Method 87
Function 82
Class 38
Enum 5

Languages

Rust100%

Modules by API surface

src/types.rs73 symbols
src/sender/mod.rs42 symbols
src/shm/ring.rs21 symbols
src/metrics.rs15 symbols
src/consumer/shm.rs15 symbols
src/shm/eventfd.rs13 symbols
tests/shm_flow.rs10 symbols
src/shm/uds.rs7 symbols
src/transport.rs6 symbols
src/wire.rs5 symbols
src/sender/shm.rs4 symbols
src/error.rs1 symbols

For agents

$ claude mcp add qlaster-public \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact