Referencia Zigmedia-daemon: IPC de ingesta

media-daemon/ipc/ingest_ipc.zig

Declaraciones públicas de media-daemon/ipc/ingest_ipc.zig (media-daemon: IPC de ingesta).

ImplementadoSin versión del tren todavía· generada desde apps/docs/generated/zig/media-daemon-ipc-ingest.json

Página generada desde native/zig/media-daemon/ipc/ingest_ipc.zig. No se edita a mano: bun run docs:gen la regenera y bun run docs:check falla si difiere.

Ingest handlers of the control socket (dec-0121, dec-0120; protocols/session-ipc messages/ingest.md). Bun decides who may upload (playback-svc, after resolving the user's access token), the daemon executes: it binds an ingest session in the capability authority and reports finished uploads. Bytes never travel here: the client uploads to the IngestSink's endpoint.

cmd.media.openIngest{capActor, capResource} -> {result: {sessionId, endpoint, rootId}} | {error} cmd.media.pollIngestEvents{ackSeq} -> {events: [...]} | {error} cmd.media.closeIngest{sessionId} -> {closed}

Requests arrive already verified by spire (signature, allowlist from BUS_ROUTES, contract: digest shapes, handle alphabet, bounds); what is left here is what the schema cannot say.

openIngest binds ing_<32 hex> to the actor and to this daemon's ingest root (the resource must be ingestRoot(rootId), anything else is refused): an SCT of scope ingest for that session is what the sink accepts. closeIngest unbinds it: every token of the session dies at once (revocation), and the sink aborts its unfinished uploads (slot, staging reservation and .part back). pollIngestEvents acknowledges every event up to ackSeq (playback-svc had catalog register them) and returns the oldest unacknowledged ones, at most max_events_per_reply.

Context

type · línea 36

pub const Context = struct

What the ingest handlers need from the daemon (nothing owned).

max_events_per_reply

const · línea 45

pub const max_events_per_reply = 32

MAX_INGEST_EVENTS_PER_POLL of the contract (maxItems of events).

openIngest

fn · línea 52

pub fn openIngest(ctx: Context, arena: std.mem.Allocator, req: contracts.MediaOpenIngestRequest) std.mem.Allocator.Error!OpenReply

cmd.media.openIngest. Strings of the reply live in arena.

unbindIngest

fn · línea 88

pub fn unbindIngest(ctx: Context, session_id: []const u8) bool

Undo of an openIngest whose reply could not be sealed (spire onReplyFailure): nobody would get the id to close it. Also the body of closeIngest.

Unbinding kills every token of the session; IngestSink.revoke then aborts its uploads, so a closed (or swept, abandoned) session stops holding its actor's upload slot and staging reservation at once instead of until conduit's idle expiry. Unbind first: after it no token of the session is admitted again. The sink is revoked even when the binding was already gone (a retried close cleans up whatever is left).

pollIngestEvents

fn · línea 97

pub fn pollIngestEvents(ctx: Context, arena: std.mem.Allocator, req: contracts.MediaPollIngestEventsRequest) std.mem.Allocator.Error!PollReply

cmd.media.pollIngestEvents. The events live in arena.

closeIngest

fn · línea 122

pub fn closeIngest(ctx: Context, req: contracts.MediaCloseIngestRequest) contracts.MediaCloseIngestReply

cmd.media.closeIngest: unbinding revokes every token of the session. Idempotent: closed: false when it was not bound (any more).