Skip to main content

fmf_contract/
opcodes.rs

1//! Pipe opcodes (docs/ARCHITECTURE.md opcode table). Event pushes reuse
2//! 1..=6 as the event *kind* with `flags = event` — dispatch must branch on
3//! the flag before the opcode.
4
5/// `Hello`: connection handshake and version negotiation (maps to `fmf_abi_version`).
6pub const HELLO: u16 = 1;
7/// `Subscribe`: push events to this connection from now on (maps to `fmf_set_event_callback(cb≠NULL)`).
8pub const SUBSCRIBE: u16 = 2;
9/// `Unsubscribe`: stop pushing events (maps to `fmf_set_event_callback(NULL)`).
10pub const UNSUBSCRIBE: u16 = 3;
11/// `ListVolumes`: return the state and entry count of every volume (maps to `fmf_list_volumes`).
12pub const LIST_VOLUMES: u16 = 4;
13/// `IndexStart`: start indexing the given volume (maps to `fmf_index_start`; persisted to service.json).
14pub const INDEX_START: u16 = 5;
15/// `IndexStatus`: return index progress and state (maps to `fmf_index_status`; same shape as `ListVolumes`).
16pub const INDEX_STATUS: u16 = 6;
17/// `Query`: run a query and return `result_id` and the entry count (maps to `fmf_query`).
18pub const QUERY: u16 = 7;
19/// `ResultPage`: fetch a row page from `result_id`'s results (maps to `fmf_result_page`).
20pub const RESULT_PAGE: u16 = 8;
21/// `ResultFree`: free `result_id`'s result handle (maps to `fmf_result_free`).
22pub const RESULT_FREE: u16 = 9;
23/// `Stats`: return the engine's metrics snapshot (maps to `fmf_engine_stats`).
24pub const STATS: u16 = 10;
25/// Number reserved, deliberately unimplemented (client-driven flush is a
26/// local-DoS lever — ADR-0016).
27pub const FLUSH_RESERVED: u16 = 11;
28/// `ServiceInfo`: return service-specific runtime info (`uptime_ms` / connections / version).
29pub const SERVICE_INFO: u16 = 12;