Skip to documentation
SLOP

tiny.pdf.FilterStorage

Reference tiny.pdf FilterStorage

Defined in tiny.pdf.

API (17)

Actions

Public operations.

Types and contracts

Public types and contracts.

Fields and members

Public fields and members.

No direct callersNo direct callstiny.pdfFilterStorage
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/pdf/src/filter/storage.zig:19

zig
pub const Storage = struct {    phase: alloc_phase.capacity.Phase,    capacity: capacity_mod.Capacity,    bytes: []align(capacity_mod.storage_alignment) u8,    output: []u8,    in_use: bool = false,    pub const Limits: type = capacity_mod.Limits;    pub const Capacity: type = capacity_mod.Capacity;    pub const Exhaustion: type = model.Exhaustion;    pub const InitError: type = std.mem.Allocator.Error;    pub const AcquireError = model.Exhaustion || error{DecodeStorageInUse};    pub const claim: alloc_phase.capacity.Declaration = .{        .source = .{            .id = "pdf.filter_storage",            .kind = .phase_static,            .limit_source = .caller,            .storage = .{                .covered = &.{                    .{                        .id = "decoded_stream_output",                        .lifetime = .steady,                        .detail = "decoded stream output",                    },                },                .excluded = &.{                    "caller-owned PDF input bytes",                    "PDF object graph, caches, and extracted text",                    "filesystem and presentation storage",                },            },            .capacity = .{                .inputs = &.{                    alloc_phase.capacity.bindInput(Limits, "bounds_decoded_bytes", "bounds.decoded_bytes"),                },                .type_selectors = &.{},                .nodes = &.{                    .{ .input = 0 },                },                .assertions = &.{.{                    .scope = .closure_total,                    .measure = .retained,                    .relation = .exact,                    .expression = 0,                }},            },            .overload = .{                .kind = .reject_before_mutation,                .detail = "Input rejects first; decode overflow remains private and unpublished.",            },            .risks = .{                .transitive = .{                    .status = .witnessed,                    .detail = "One region covers DEFLATE and predictor reconstruction.",                },                .foreign = .{                    .status = .excluded,                    .detail = "stream decoding is process-local and crosses no callback or OS edge",                },            },            .obligations = &.{                .{ .key = "pdf_filter_capacity", .role = .capacity_model },                .{ .key = "pdf_filter_acquisition", .role = .custom },                .{ .key = "pdf_filter_oom", .role = .custom },                .{ .key = "pdf_filter_boundaries", .role = .overload },                .{ .key = "pdf_filter_reuse", .role = .overload },                .{ .key = "pdf_filter_decode_overflow", .role = .overload },                .{ .key = "pdf_filter_sealed", .role = .transitive_risk },                .{ .key = "pdf_filter_root", .role = .custom },                .{ .key = "pdf_filter_consumer", .role = .foreign_risk },            },        },        .bindings = .{            .owner = @This(),            .seal = .{                .family = alloc_phase.capacity.selector(@This().activate),                .premise = .{                    .class = .checked_semantic_fact,                    .authority = .checker,                },            },            .teardown = .{                .family = alloc_phase.capacity.selector(@This().deinit),                .premise = .{                    .class = .checked_semantic_fact,                    .authority = .checker,                },            },        },    };    pub fn init(allocator: std.mem.Allocator, limits: Limits) InitError!Storage {        const capacity = Capacity.derive(limits);        const bytes = try allocator.alignedAlloc(            u8,            .fromByteUnits(capacity_mod.storage_alignment),            capacity.storage_bytes,        );        return .{            .phase = .initialization,            .capacity = capacity,            .bytes = bytes,            .output = bytes[0..capacity.bounds.decoded_bytes],        };    }    pub fn activate(self: *Storage) void {        std.debug.assert(self.phase == .initialization);        std.debug.assert(self.bytes.len == self.capacity.storage_bytes);        self.phase = .steady;    }    pub fn acquire(self: *Storage, input_bytes: usize) AcquireError!Regions {        std.debug.assert(self.phase == .steady);        if (self.in_use) return error.DecodeStorageInUse;        if (input_bytes > self.capacity.bounds.input_bytes) {            return error.InputByteCapacityExceeded;        }        self.in_use = true;        return .{ .output = self.output };    }    pub fn reset(self: *Storage) void {        std.debug.assert(self.phase == .steady);        std.debug.assert(self.in_use);        self.in_use = false;    }    pub fn status(self: *const Storage) Status {        return .{            .phase = self.phase,            .in_use = self.in_use,            .input_bytes = self.capacity.bounds.input_bytes,            .decoded_bytes = self.capacity.bounds.decoded_bytes,            .storage_bytes = self.capacity.storage_bytes,        };    }    pub fn deinit(self: *Storage, allocator: std.mem.Allocator) void {        std.debug.assert(self.phase != .teardown);        std.debug.assert(!self.in_use);        std.debug.assert(self.bytes.len == self.capacity.storage_bytes);        self.phase = .teardown;        allocator.free(self.bytes);        self.bytes = &.{};        self.output = &.{};    }};

Source: lib/pdf/src/root.zig:29

zig
pub const FilterStorage = filter.Storage;
Called byCallsNo direct callstest sourcelib.pdf.src.filter.storagetest: PDF filter storage acquires one...FilterStorageacquire
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.pdf.src.filter.storagetest: PDF filter storage acquires one...FilterStorageactivate
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsprivate sourcelib.pdf.src.filter.storagecheckInitFailurestest sourcelib.pdf.src.filter.storagetest: PDF filter storage acquires one...FilterStoragedeinit
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callsprivate sourcelib.pdf.src.filter.storagecheckInitFailurestest sourcelib.pdf.src.filter.storagetest: PDF filter storage acquires one...FilterStorageinit
Static calls · unresolved targets: 1 · external targets: 1.
Called byCallsNo direct callstest sourcelib.pdf.src.filter.storagetest: PDF filter storage acquires one...FilterStoragereset
Static calls · unresolved targets: 0 · external targets: 0.

Also reachable as

filter.Storage.

Audit

Definitions13
Public names26
Members5
Version26.7.0
Revisiondaab053ee433