Skip to main content

Module proto

Module proto 

Source
Expand description

The daemon wire protocol: length-prefixed frames over a Unix socket.

Deliberately tiny and hand-encoded (no serde): a request is one tag byte plus fields; the response is a stream of non-empty data frames terminated by a zero-length frame, so results (rendered path:line:text, a file list, or status text) flow without buffering huge sets.

Structs§

FindHeader

Enums§

Request

Constants§

FIND_HEADER_SENTINEL
Find responses optionally lead with a one-line header \x01<total>\t<start>\t<returned>\t<next_after>\n so the client can report the true total (not just the truncated page), the keyset offset (start = items skipped before this page, for an honest “X-Y of N” range), and resume via next_after. The 0x01 sentinel can’t begin a real path line, and older/headerless blobs parse as all-paths.

Functions§

end_stream
format_find_header
parse_find_header
Split a Find response blob into its optional header and the remaining path lines.
read_request
read_stream
Read a response stream, writing each chunk to sink; returns total bytes written.
read_stream_to_vec
Convenience: collect a whole response stream into a Vec (for small responses like status/find).
read_watch_frame
Read one frame from an open-ended stream (e.g. Watch), returning None when the stream ends (zero-length terminator or the daemon closing the connection).
write_data
Responses are a stream of non-empty data frames terminated by a zero-length frame, so the daemon can emit results as it finds them and the client writes them straight to stdout (no buffering of huge result sets on either side).
write_request