Skip to documentation
SLOP

tiny.trace.TraceWriterStorage

Reference tiny.trace TraceWriterStorage

Defined in tiny.trace.

API (15)

Actions

Public operations.

Types and contracts

Public types and contracts.

Fields and members

Public fields and members.

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

Source

Source: lib/trace/src/store/writer/storage.zig:47

zig
pub const Storage = struct {    phase: alloc_phase.capacity.Phase,    capacity: capacity_mod.Capacity,    bytes: []u8,    in_use: bool = false,    pub const Limits: type = capacity_mod.Limits;    pub const Capacity: type = capacity_mod.Capacity;    pub const Exhaustion: type = @import("storage.zig").Exhaustion;    pub const InitError = std.mem.Allocator.Error || capacity_mod.DeriveError;    pub const claim: alloc_phase.capacity.Declaration = .{        .source = .{            .id = "trace.trace_writer_storage",            .kind = .phase_static,            .limit_source = .caller,            .storage = .{                .covered = &.{                    .{                        .id = "retained_trace_path_and_manifest_identity_bytes",                        .lifetime = .steady,                        .detail = "retained trace path and manifest identity bytes",                    },                    .{                        .id = "phase_shared_bounded_binary_event_block_and_manifes_21808f4010ec",                        .lifetime = .steady,                        .detail = "phase-shared bounded binary event block and manifest encoding scratch",                    },                    .{                        .id = "manifest_file_i_o_and_two_simultaneous_path_construction_buffers",                        .lifetime = .steady,                        .detail = "manifest file I/O and two simultaneous path-construction buffers",                    },                    .{                        .id = "bounded_lib_sql_wal_pager_transaction_and_checkpoint_heap",                        .lifetime = .steady,                        .detail = "bounded lib/sql WAL pager transaction and checkpoint heap",                    },                },                .excluded = &.{                    "filesystem implementation and kernel file state",                    "recording Session state and event payload pointees",                    "trace reader parsing and replay storage",                },            },            .capacity = .{                .inputs = &.{                    alloc_phase.capacity.bindInput(Limits, "build_id_bytes", "build_id_bytes"),                    alloc_phase.capacity.bindInput(Limits, "endian_bytes", "endian_bytes"),                    alloc_phase.capacity.bindInput(Limits, "event_bytes", "event_bytes"),                    alloc_phase.capacity.bindInput(Limits, "manifest_io_bytes", "manifest_io_bytes"),                    alloc_phase.capacity.bindInput(Limits, "mode_bytes", "mode_bytes"),                    alloc_phase.capacity.bindInput(Limits, "root_path_bytes", "root_path_bytes"),                    alloc_phase.capacity.bindInput(Limits, "target_triple_bytes", "target_triple_bytes"),                },                .type_selectors = &.{},                .nodes = &.{                    .{ .input = 0 },                    .{ .input = 1 },                    .{ .input = 2 },                    .{ .input = 3 },                    .{ .input = 4 },                    .{ .input = 5 },                    .{ .input = 6 },                    .{ .add = .{ .left = 0, .right = 1 } },                    .{ .add = .{ .left = 7, .right = 2 } },                    .{ .add = .{ .left = 8, .right = 3 } },                    .{ .add = .{ .left = 9, .right = 4 } },                    .{ .add = .{ .left = 10, .right = 5 } },                    .{ .add = .{ .left = 11, .right = 6 } },                },                .assertions = &.{.{                    .scope = .closure_total,                    .measure = .retained,                    .relation = .upper_bound,                    .expression = 12,                }},            },            .overload = .{                .kind = .reject_before_mutation,                .detail = "open rejects every retained byte region at max plus one before acquiring storage or mutating the trace path",            },            .risks = .{                .transitive = .{                    .status = .witnessed,                    .detail = "open, binary block encode, SQL append, bounded checkpoint, and finish consume only preflighted writer regions after activation",                },                .foreign = .{                    .status = .excluded,                    .detail = "filesystem calls and kernel buffering remain effects outside the caller allocator and this storage owner",                },            },            .dependencies = &.{ "sql.wal_writer", "sql.file_transaction_staging" },            .obligations = &.{                .{ .key = "trace_trace_writer_capacity", .role = .capacity_model },                .{ .key = "trace_trace_writer_acquisition", .role = .custom },                .{ .key = "trace_trace_writer_oom", .role = .custom },                .{ .key = "trace_trace_writer_boundary", .role = .overload },                .{ .key = "trace_trace_writer_open_atomic", .role = .overload },                .{ .key = "trace_trace_writer_sealed", .role = .transitive_risk },                .{ .key = "trace_trace_writer_rollover", .role = .foreign_risk },                .{ .key = "trace_trace_writer_root", .role = .custom },                .{ .key = "trace_trace_writer_tuning", .role = .custom },            },        },        .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 = try Capacity.derive(limits);        return .{            .phase = .initialization,            .capacity = capacity,            .bytes = try allocator.alloc(u8, capacity.storage_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, usage: Usage) Storage.Exhaustion!Regions {        std.debug.assert(self.phase == .steady);        if (self.in_use) return error.WriterStorageInUse;        if (usage.root_path_bytes > self.capacity.root_path_bytes) return error.RootPathCapacityExceeded;        if (usage.target_triple_bytes > self.capacity.target_triple_bytes) return error.TargetTripleCapacityExceeded;        if (usage.build_id_bytes > self.capacity.build_id_bytes) return error.BuildIdCapacityExceeded;        if (usage.mode_bytes > self.capacity.mode_bytes) return error.ModeCapacityExceeded;        if (usage.endian_bytes > self.capacity.endian_bytes) return error.EndianCapacityExceeded;        if (usage.event_bytes > self.capacity.event_bytes) return error.EventCapacityExceeded;        self.in_use = true;        return .{            .root_path = self.region(self.capacity.root_path_offset, usage.root_path_bytes),            .target_triple = self.region(self.capacity.target_triple_offset, usage.target_triple_bytes),            .build_id = self.region(self.capacity.build_id_offset, usage.build_id_bytes),            .mode = self.region(self.capacity.mode_offset, usage.mode_bytes),            .endian = self.region(self.capacity.endian_offset, usage.endian_bytes),            .block = self.region(self.capacity.block_offset, self.capacity.block_bytes),            .manifest_io = self.region(self.capacity.manifest_io_offset, self.capacity.manifest_io_bytes),            .sql = self.region(self.capacity.sql_offset, self.capacity.sql_bytes),            .manifest = self.region(self.capacity.manifest_offset, self.capacity.manifest_bytes),            .paths = .{                self.region(self.capacity.path_offsets[0], self.capacity.path_bytes),                self.region(self.capacity.path_offsets[1], self.capacity.path_bytes),            },        };    }    pub fn release(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,            .storage_bytes = self.capacity.storage_bytes,            .event_bytes = self.capacity.event_bytes,            .block_bytes = self.capacity.block_bytes,            .manifest_io_bytes = self.capacity.manifest_io_bytes,            .sql_bytes = self.capacity.sql_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 = &.{};    }    fn region(self: *Storage, offset: usize, count: usize) []u8 {        return self.bytes[offset..][0..count];    }};

Source: lib/trace/src/root.zig:68

zig
pub const TraceWriterStorage = store.WriterStorage;
Called byCallstest sourcelib.trace.src.store.writer.storagetest: trace writer storage acquires o...test sourcelib.trace.src.store.writer.storagetest: trace writer storage rejects ev...private sourcelib.trace.src.store.writer.storage.StorageregionTraceWriterStorageacquire
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.trace.src.store.writer.storagetest: trace writer storage acquires o...test sourcelib.trace.src.store.writer.storagetest: trace writer storage rejects ev...TraceWriterStorageactivate
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsprivate sourcelib.trace.src.store.writer.storagecheckInitFailurestest sourcelib.trace.src.store.writer.storagetest: trace writer storage acquires o...test sourcelib.trace.src.store.writer.storagetest: trace writer storage rejects ev...TraceWriterStoragedeinit
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callsprivate sourcelib.trace.src.store.writer.storagecheckInitFailurestest sourcelib.trace.src.store.writer.storagetest: trace writer storage acquires o...test sourcelib.trace.src.store.writer.storagetest: trace writer storage rejects ev...TraceWriterStorageinit
Static calls · unresolved targets: 1 · external targets: 1.
Called byCallsNo direct callstest sourcelib.trace.src.store.writer.storagetest: trace writer storage acquires o...test sourcelib.trace.src.store.writer.storagetest: trace writer storage rejects ev...TraceWriterStoragerelease
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.trace.src.store.writer.storagetest: trace writer storage rejects ev...TraceWriterStoragestatus
Static calls · unresolved targets: 0 · external targets: 0.

Also reachable as

store.WriterStorage.

Audit

Definitions11
Public names22
Members4
Version26.7.0
Revisiondaab053ee433