/** * VSR consensus header layout, ported from * `core/binary_protocol/src/consensus/header.rs`. Every consensus frame in * both directions starts with a 256-byte header. Fields are read and written * by byte offset, mirroring the Rust SDK, which avoids struct casts because * the headers lead with unaligned u128 fields. */ /** Size of every consensus header, both directions. */ export declare const HEADER_SIZE = 256; /** * `RequestHeader` field offsets the client writes. * * The client wire carries no routing namespace: the server derives the * consensus group (plane from `operation`, partition target from the payload) * and stamps it into its own internal header. Everything that followed the * removed field therefore sits eight bytes earlier than in the pre-derivation * layout. */ export declare const REQUEST_OFFSET: { readonly size: 48; readonly command: 60; readonly client: 128; readonly timestamp: 160; readonly request: 168; readonly operation: 176; readonly session: 184; readonly reserved: 196; }; /** `ReplyHeader` field offsets the client reads. */ export declare const REPLY_OFFSET: { readonly size: 48; readonly command: 60; readonly commit: 184; readonly operation: 208; readonly status: 216; }; /** `EvictionHeader` field offsets the client reads. */ export declare const EVICTION_OFFSET: { readonly command: 60; readonly client: 128; readonly serverProtocolVersion: 144; readonly serverProtocolVersionMin: 148; readonly reason: 255; }; /** `Command` frame discriminants a client encounters. */ export declare const Command: { readonly Request: 5; readonly Reply: 8; readonly Eviction: 13; }; /** * `EvictionReason` values, mirroring * `core/binary_protocol/src/consensus/header.rs`. */ export declare const EvictionReason: { readonly Reserved: 0; readonly NoSession: 1; readonly ClientReleaseTooLow: 2; readonly ClientReleaseTooHigh: 3; readonly InvalidRequestOperation: 4; readonly InvalidRequestBody: 5; readonly InvalidRequestBodySize: 6; readonly SessionTooLow: 7; readonly SessionReleaseMismatch: 8; readonly InvalidCredentials: 9; readonly InvalidToken: 10; readonly UserInactive: 11; readonly SessionError: 12; readonly StaleClient: 13; readonly IncompatibleProtocol: 14; readonly MalformedLogin: 15; }; /** Fields the client writes into a request header. */ export type RequestHeaderFields = { /** Header + body total, bytes. */ size: number; /** Ephemeral client identifier (u128). */ client: bigint; /** Request id (u64): 0 for Register, else per session rules. */ request: bigint; /** `Operation` discriminant. */ operation: number; /** Bound session (u64), or 0n. */ session: bigint; /** Command code for `NonReplicated`, placed in `reserved[0..4]`. */ nonReplicatedCode?: number; }; /** * Encodes a 256-byte request header. Only the six fields the server reads * are written. The checksums stay zero: the frame and body checksums are not * read on the client request path, and `request_checksum` treats zero as * unstamped, which opts out of the server's payload comparison. Stamping it is * optional -- the Rust SDK does for deduped ops, this SDK does not yet. */ export declare const encodeRequestHeader: (fields: RequestHeaderFields) => Buffer; /** * Reads the frame discriminant. `command` sits at the same offset in every * consensus header, so one byte discriminates the frame type. */ export declare const peekCommand: (header: Buffer) => number; /** Reads the total frame size from a reply or eviction header. */ export declare const readSize: (header: Buffer) => number; /** Reads the pre-commit denial status; 0 means the reply committed. */ export declare const readStatus: (header: Buffer) => number; /** Reads the `Operation` discriminant from a reply header. */ export declare const readReplyOperation: (header: Buffer) => number; /** Decoded eviction frame. */ export type Eviction = { reason: number; serverProtocolVersion: number; serverProtocolVersionMin: number; }; /** Reads the fields of an eviction header the client acts on. */ export declare const readEviction: (header: Buffer) => Eviction; //# sourceMappingURL=header.d.ts.map