Referencia Zigconduit-zig (SDK consumido)

zig/resume_state.zig

Declaraciones públicas de zig/resume_state.zig (conduit-zig (SDK consumido)).

ImplementadoSin versión del tren todavía· generada desde apps/docs/generated/zig/conduit.json

Página generada desde conduit@conduit-0.1.0-f7J_7zg5DwCsHBHItwdOz9ZVq8cvH7ceFsk7-m3-T61t (zig/root.zig). No se edita a mano: bun run docs:gen la regenera y bun run docs:check falla si difiere.

Resume state of a client upload, kept on disk so a killed process can continue: a small record (the CLI stores the server's uploadId; a host may add its own session id) per (file identity, server), under $XDG_STATE_HOME/<app>/ or ~/.local/state/<app>/, mode 0600, written with rename so a crash never leaves half a record. The chunk list itself is never stored: on resume the server's list is the truth (spec §4.3).

The directory comes from the user's environment; once it exists every access goes through a zkit.safety.fs.Root on it (the record is an entry of that root: a symlink planted under its name is never followed).

resume_state.max_record_len

const · línea 16

pub const max_record_len = 1024

Sin ///.

resume_state.ResumeState

type · línea 20

pub const ResumeState = struct

Sin ///.

resume_state.ResumeState.init

fn · línea 29

pub fn init( gpa: std.mem.Allocator, environ: *const std.process.Environ.Map, app: []const u8, server: []const u8, file_path: []const u8, st: zkit.fs.Stat, ) std.mem.Allocator.Error!ResumeState

app names the state directory; server is the base URL (a file uploaded to two servers resumes separately). environ is the process environment (XDG_STATE_HOME, HOME). Without a home the state is disabled (every call is a no-op).

resume_state.ResumeState.deinit

fn · línea 60

pub fn deinit(s: *ResumeState, gpa: std.mem.Allocator) void

Sin ///.

resume_state.ResumeState.load

fn · línea 70

pub fn load(s: *const ResumeState, buf: *[max_record_len]u8) ?[]const u8

The saved record (trimmed), or null.

resume_state.ResumeState.loadUploadId

fn · línea 82

pub fn loadUploadId(s: *const ResumeState) ?wire.UploadId

The saved record as a bare uploadId (the conduit CLI's format).

resume_state.ResumeState.save

fn · línea 88

pub fn save(s: *const ResumeState, record: []const u8) void

Best effort: losing the state only costs a fresh session.

resume_state.ResumeState.clear

fn · línea 107

pub fn clear(s: *const ResumeState) void

Best effort, like save.