Skip to main content

Module codec

Module codec 

Source
Expand description

Pure, I/O-free encodings between the io_replica model and the pimdir columns (spec §13). No SQLite, no filesystem: the part an Android or any other implementation reuses.

Beside the column encodings it holds the action-queue payload codec (spec §15.3): the six v1 action kinds as PimdirAction, encoded to and from the versioned JSON queue.payload column.

Enums§

PimdirAction
A queued mutation request (spec §15.3): what a producer appends to the queue table and the owner applies to the store.
PimdirActionError
A malformed action payload; the owner parks the row instead of applying it.

Functions§

action_from_payload
Decodes a queue.action kind plus its queue.payload JSON back to a PimdirAction, the inverse of action_to_payload. Strict, unlike the lenient column decoders: a malformed payload is an error the owner parks the row with, never a silently-empty action.
action_to_payload
Encodes an action to its versioned JSON queue.payload column (spec §15.3, v: 1). Absent optional fields are omitted; meta embeds as parsed JSON when it is valid JSON, else as a JSON string.
flags_from_json
The inverse of flags_to_json: a NULL column decodes to the unknown set, and so does a column this cannot read.
flags_to_json
A flag set to its canonical JSON array, the model’s set being already sorted, or None for the column’s NULL.
level_from_int
The inverse of level_to_int; unknown integers clamp to Probed.
level_to_int
The detail ladder as its column integer (spec §13).