Skip to main content

Crate pylon_router

Crate pylon_router 

Source
Expand description

Platform-agnostic HTTP router for pylon.

This crate contains the pure routing logic that maps HTTP requests to data store operations. It has no I/O dependencies — no tiny_http, no tungstenite, no rusqlite. It works with any DataStore implementation (SQLite Runtime, Cloudflare D1, etc.).

Structs§

NoopNotifier
No-op notifier for platforms without real-time push.
NoopPluginHooks
No-op plugin hooks for platforms or tests without a registry.
RouterContext

Enums§

FrameEncodeError
Errors from encode_crdt_frame. Surfaced loud rather than silently truncating so a pathological entity / row_id name (>64 KiB) becomes an observable failure instead of a malformed frame the client can’t decode.

Constants§

CRDT_FRAME_SNAPSHOT
Frame type for a full CRDT snapshot.
CRDT_FRAME_UPDATE
Frame type for an incremental CRDT update (reserved — not yet emitted).

Traits§

CacheOps
Cache operations used by the router.
ChangeNotifier
Receives change notifications for real-time sync.
EmailSender
Sends emails (magic codes, invitations, etc.).
FileOps
File storage operations used by the router.
FnOps
TypeScript function operations used by the router.
JobOps
Job queue operations used by the router.
OpenApiGenerator
Generates the OpenAPI spec JSON string for the manifest.
PluginHookOps
Plugin CRUD lifecycle hooks used by the router.
PubSubOps
Pub/Sub operations used by the router.
RoomOps
Room operations used by the router.
SchedulerOps
Scheduler operations used by the router.
ShardOps
Access to sharded real-time simulations (game matches, MMO zones, etc.).
WorkflowOps
Workflow engine operations used by the router.

Functions§

broadcast_change_with_crdt
Convenience: emit BOTH the JSON change event AND the binary CRDT snapshot frame after a successful insert/update on a CRDT-mode entity. The CRDT snapshot is fetched via DataStore::crdt_snapshot; for crdt: false entities (the LWW opt-out) it returns Ok(None) and we skip the binary broadcast cleanly.
encode_crdt_frame
Encode a CRDT broadcast frame. Layout documented at the top of this module. Returns the encoded bytes on success; errors when entity / row_id can’t fit the 16-bit length header (~65 KiB, never hit in practice).
json_error
json_error_safe
json_error_with_hint
route
Route an HTTP request to the appropriate handler.