Skip to documentation
SLOP

tiny.http.ClientOperationStorage

Reference tiny.http ClientOperationStorage

Defined in tiny.http.

API (12)

Actions

Public operations.

Types and contracts

Public types and contracts.

Fields and members

Public fields and members.

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

Source

Source: lib/http/src/client/operation/storage.zig:9

zig
pub const Storage = struct {    phase: alloc_phase.capacity.Phase,    capacity: model.Capacity,    bytes: []u8,    pub const Limits: type = model.Limits;    pub const Capacity: type = model.Capacity;    pub const Exhaustion: type = StorageExhaustion;    pub const InitError = std.mem.Allocator.Error || error{CapacityOverflow};    pub const claim: alloc_phase.capacity.Declaration = .{        .source = .{            .id = "http.client_operation_storage",            .kind = .phase_static,            .limit_source = .caller,            .storage = .{                .covered = &.{                    .{                        .id = "fixed_decoded_host_bytes_for_every_concurrent_client_operation",                        .lifetime = .steady,                        .detail = "fixed decoded host bytes for every concurrent client operation",                    },                    .{                        .id = "normalized_request_target_bytes_for_every_client_operation",                        .lifetime = .steady,                        .detail = "normalized request-target bytes for every client operation",                    },                    .{                        .id = "plain_socket_windows_for_every_client_operation",                        .lifetime = .steady,                        .detail = "plain-socket windows for every client operation",                    },                },                .excluded = &.{                    "TLS buffers, certificate bundles, sockets, DNS state, and kernel queues",                    "borrowed request inputs, response storage, handlers, and handler output",                },            },            .capacity = .{                .inputs = &.{                    alloc_phase.capacity.bindInput(Limits, "host_bytes_per_operation", "host_bytes_per_operation"),                    alloc_phase.capacity.bindInput(Limits, "target_bytes_per_operation", "target_bytes_per_operation"),                    alloc_phase.capacity.bindInput(Limits, "plain_read_bytes_per_operation", "plain_read_bytes_per_operation"),                    alloc_phase.capacity.bindInput(Limits, "plain_write_bytes_per_operation", "plain_write_bytes_per_operation"),                    alloc_phase.capacity.bindInput(Limits, "operation_count", "operation_count"),                },                .type_selectors = &.{},                .nodes = &.{                    .{ .input = 0 },                    .{ .input = 1 },                    .{ .input = 2 },                    .{ .input = 3 },                    .{ .add = .{ .left = 0, .right = 1 } },                    .{ .add = .{ .left = 4, .right = 2 } },                    .{ .add = .{ .left = 5, .right = 3 } },                    .{ .input = 4 },                    .{ .product = .{ .left = 7, .right = 6 } },                },                .assertions = &.{.{                    .scope = .closure_total,                    .measure = .retained,                    .relation = .exact,                    .expression = 8,                }},            },            .overload = .{                .kind = .terminal,                .detail = "capacity exhaustion rejects before connection or output publication",            },            .risks = .{                .transitive = .{                    .status = .witnessed,                    .detail = "URL preparation and request serialization allocate no storage",                },                .foreign = .{                    .status = .excluded,                    .detail = "TLS and operating-system network owners remain independent",                },            },            .obligations = &.{                .{ .key = "http_client_operation_capacity", .role = .capacity_model },                .{ .key = "http_client_operation_oom_retry", .role = .custom },                .{ .key = "http_client_operation_partition", .role = .custom },                .{ .key = "http_client_operation_sealed", .role = .transitive_risk },                .{ .key = "http_client_operation_boundary", .role = .custom },                .{ .key = "http_client_operation_atomic", .role = .overload },                .{ .key = "http_client_operation_network_overload", .role = .overload },                .{ .key = "http_client_operation_network_foreign_risk", .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 = try Capacity.derive(limits);        const bytes = if (capacity.storage_bytes == 0)            @as([]u8, &.{})        else            try allocator.alloc(u8, capacity.storage_bytes);        std.debug.assert(bytes.len == capacity.storage_bytes);        return .{            .phase = .initialization,            .capacity = capacity,            .bytes = 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 operation(self: *Storage, index: usize) Exhaustion!Scratch {        std.debug.assert(self.phase == .steady);        if (index >= self.capacity.operation_count) {            return error.ClientOperationCapacityExceeded;        }        const host_start = index * self.capacity.host_bytes_per_operation;        const target_region_start = self.capacity.host_bytes;        const target_start = target_region_start +            index * self.capacity.target_bytes_per_operation;        const plain_read_region_start = target_region_start + self.capacity.target_bytes;        const plain_read_start = plain_read_region_start +            index * self.capacity.plain_read_bytes_per_operation;        const plain_write_region_start = plain_read_region_start + self.capacity.plain_read_bytes;        const plain_write_start = plain_write_region_start +            index * self.capacity.plain_write_bytes_per_operation;        const plain_read_region = self.bytes[plain_read_start..];        const plain_write_region = self.bytes[plain_write_start..];        std.debug.assert(host_start <= self.capacity.host_bytes);        std.debug.assert(target_start <= plain_read_region_start);        std.debug.assert(plain_read_start <= plain_write_region_start);        std.debug.assert(plain_write_start <= self.bytes.len);        return .{            .host = self.bytes[host_start..][0..self.capacity.host_bytes_per_operation],            .target = self.bytes[target_start..][0..self.capacity.target_bytes_per_operation],            .plain_read = plain_read_region[0..self.capacity.plain_read_bytes_per_operation],            .plain_write = plain_write_region[0..self.capacity.plain_write_bytes_per_operation],        };    }    pub fn deinit(self: *Storage, allocator: std.mem.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/http/src/root.zig:87

zig
pub const ClientOperationStorage = client.OperationStorage;
Called byCallsNo direct callstest sourcelib.http.src.client.operation.storagetest: Client operation remains alloca...test sourcelib.http.src.client.operation.storagetest: Client operation storage partit...ClientOperationStorageactivate
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsprivate sourcelib.http.src.client.operation.storagecheckStorageInitFailurestest sourcelib.http.src.client.operation.storagetest: Client operation remains alloca...test sourcelib.http.src.client.operation.storagetest: Client operation storage partit...ClientOperationStoragedeinit
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callsprivate sourcelib.http.src.client.operation.storagecheckStorageInitFailurestest sourcelib.http.src.client.operation.storagetest: Client operation remains alloca...test sourcelib.http.src.client.operation.storagetest: Client operation storage partit...ClientOperationStorageinit
Static calls · unresolved targets: 1 · external targets: 1.
Called byCallsNo direct callstest sourcelib.http.src.client.operation.storagetest: Client operation remains alloca...test sourcelib.http.src.client.operation.storagetest: Client operation storage partit...ClientOperationStorageoperation
Static calls · unresolved targets: 0 · external targets: 0.

Audit

Definitions10
Public names10
Members3
Version26.7.0
Revisiondaab053ee433