Skip to documentation
SLOP

tiny.sql.RowValueStorage

Reference tiny.sql RowValueStorage

Defined in table.

API (12)

Actions

Public operations.

Types and contracts

Public types and contracts.

Fields and members

Public fields and members.

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

Source

Source: lib/sql/src/table.zig:41

zig
pub const ValueStorage = struct {    phase: alloc_phase.capacity.Phase,    capacity: ValueCapacity,    bytes: []u8,    pub const Limits: type = ValueLimits;    pub const Capacity: type = ValueCapacity;    pub const Exhaustion = error{ValueCapacityExceeded};    pub const InitError: type = Allocator.Error;    pub const claim: alloc_phase.capacity.Declaration = .{        .source = .{            .id = "sql.table_value_storage",            .kind = .phase_static,            .limit_source = .caller,            .storage = .{                .covered = &.{                    .{                        .id = "one_reusable_encoded_row_value_region",                        .lifetime = .steady,                        .detail = "one reusable encoded row value region",                    },                },                .excluded = &.{                    "tree traversal, database/WAL bytes, file handles, and operating-system page cache",                    "file read cache, pager history, search hit storage, and decoded result fields",                    "caller-owned keys and trace instrumentation",                },            },            .capacity = .{                .inputs = &.{                    alloc_phase.capacity.bindInput(Limits, "max_value_bytes", "max_value_bytes"),                },                .type_selectors = &.{},                .nodes = &.{                    .{ .input = 0 },                },                .assertions = &.{.{                    .scope = .closure_total,                    .measure = .retained,                    .relation = .exact,                    .expression = 0,                }},            },            .overload = .{                .kind = .reject_before_mutation,                .detail = "oversize values return ValueCapacityExceeded before reusable bytes mutate",            },            .risks = .{                .transitive = .{                    .status = .open,                    .detail = "tree reads use separate file, pager, cache, and trace owners",                },                .foreign = .{                    .status = .open,                    .detail = "base-page reads may enter the host filesystem and OS cache",                },            },            .obligations = &.{                .{ .key = "sql_table_value_capacity", .role = .capacity_model },                .{ .key = "sql_table_value_oom_retry", .role = .custom },                .{ .key = "sql_table_value_sealed", .role = .overload },                .{ .key = "sql_table_value_semantics", .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: Allocator, limits: ValueLimits) InitError!ValueStorage {        const capacity = ValueCapacity.derive(limits);        const bytes = if (capacity.storage_bytes == 0)            @as([]u8, &.{})        else            try allocator.alloc(u8, capacity.storage_bytes);        return .{            .phase = .initialization,            .capacity = capacity,            .bytes = bytes,        };    }    pub fn activate(self: *ValueStorage) void {        std.debug.assert(self.phase == .initialization);        std.debug.assert(self.bytes.len == self.capacity.storage_bytes);        self.phase = .steady;    }    pub fn get(        self: *ValueStorage,        table: *const Table,        rowid: i64,    ) (Error || Exhaustion)!?[]const u8 {        std.debug.assert(self.phase == .steady);        const value = table.getInto(rowid, self.bytes) catch |err| switch (err) {            error.OutputTooSmall => return error.ValueCapacityExceeded,            else => return err,        };        return value;    }    pub fn deinit(self: *ValueStorage, allocator: Allocator) void {        std.debug.assert(self.phase != .teardown);        std.debug.assert(self.bytes.len == self.capacity.storage_bytes);        self.phase = .teardown;        if (self.bytes.len != 0) allocator.free(self.bytes);        self.bytes = &.{};    }};

Source: lib/sql/src/root.zig:228

zig
pub const RowValueStorage = table.ValueStorage;
Called byCallsNo direct callstest sourcelib.sql.src.tabletest: table value storage initializat...test sourcelib.sql.src.tabletest: table value storage preserves t...RowValueStorageactivate
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsprivate sourcelib.sql.src.tablecheckValueStorageInitFailurestest sourcelib.sql.src.tabletest: table value storage initializat...test sourcelib.sql.src.tabletest: table value storage is sealed b...test sourcelib.sql.src.tabletest: table value storage preserves t...RowValueStoragedeinit
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callstest sourcelib.sql.src.tabletest: table value storage preserves t...RowValueStorageget
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsprivate sourcelib.sql.src.tablecheckValueStorageInitFailurestest sourcelib.sql.src.tabletest: table value storage initializat...test sourcelib.sql.src.tabletest: table value storage is sealed b...test sourcelib.sql.src.tabletest: table value storage preserves t...RowValueCapacityderiveRowValueStorageinit
Static calls · unresolved targets: 0 · external targets: 1.

Also reachable as

TableValueStorage.

Audit

Definitions10
Public names30
Members4
Version26.7.0
Revisiondaab053ee433