tiny.choir.product
Defined in tiny.choir.
API (55)
Actions
Public operations.
ProductMetadataStorage.Capacity.deriveProductMetadataStorage.activateProductMetadataStorage.deinitProductMetadataStorage.initProductMetadataStorage.regionProductMetadataStorage.statuscloneProductKeycloneProductRefdeinitProductKeydeinitProductRefderivedProductStampfingerprintBytesoperationFingerprintproductDependencyproductKeyproductRefproductRefsContainproductStamp
Types and contracts
Public types and contracts.
EntityImage: A retained view owns only immutable bytes and bytecode lookup metadata.EntityNamespaceEntityRefFingerprintFingerprintBuilderOperationConfigurationOperationFingerprintErrorOperationJob: A single mutable writer decoded from a retained image into an independent Context.OperationProductProductDependencyProductDependencyChangeProductGraphProductGraphBuilderProductGraphBuilderErrorProductKey: Borrows an owner-interned exact record.ProductMaterializationProductMetadataErrorProductMetadataStorageProductMetadataStorage.CapacityProductMetadataStorage.InitErrorProductMetadataStorage.LimitsProductRefProductRefreshDecisionProductRefreshPlanProductRefreshReasonProductRefreshReportProductStampStableHasherStableValueNumbering
Namespaces
Public namespaces.
Values and defaults
Public values and defaults.
Source
Source: lib/choir/src/product/storage.zig:22
zig
pub const Storage = struct { pub const Limits = struct { segments: [segment_count]Segment, }; pub const Capacity = struct { offsets: [segment_count]usize, byte_lengths: [segment_count]usize, alignments: [segment_count]std.mem.Alignment, total_bytes: usize, allocation_alignment: std.mem.Alignment, pub fn derive(limits: Limits) error{CapacityOverflow}!Capacity { var offsets: [segment_count]usize = undefined; var byte_lengths: [segment_count]usize = undefined; var alignments: [segment_count]std.mem.Alignment = undefined; var cursor: usize = 0; var allocation_alignment: usize = 1; for (limits.segments, &offsets, &byte_lengths, &alignments) |segment_value, *offset, *byte_length, *alignment| { byte_length.* = std.math.mul( usize, segment_value.count, segment_value.element_bytes, ) catch return error.CapacityOverflow; offset.* = try placeBytes( byte_length.*, segment_value.alignment.toByteUnits(), &cursor, &allocation_alignment, ); alignment.* = segment_value.alignment; } return .{ .offsets = offsets, .byte_lengths = byte_lengths, .alignments = alignments, .total_bytes = cursor, .allocation_alignment = .fromByteUnits(allocation_alignment), }; } }; pub const InitError = Allocator.Error || error{CapacityOverflow}; pub const claim: alloc_phase.capacity.Declaration = .{ .source = .{ .id = "choir.product_metadata_storage", .kind = .phase_static, .limit_source = .caller, .storage = .{ .covered = &.{ .{ .id = "durable_product_graph_records_and_names", .lifetime = .steady, .detail = "durable product graph records and names", }, .{ .id = "durable_refresh_plan_records_and_names", .lifetime = .steady, .detail = "durable refresh plan records and names", }, .{ .id = "durable_refresh_report_projections", .lifetime = .steady, .detail = "durable refresh report projections", }, }, .excluded = &.{ "borrowing product graph builders and closure workspaces", "caller-owned source metadata and allocator implementation state", "retained exact records in separately bounded revision stores", }, }, .capacity = .{ .inputs = &.{}, .type_selectors = &.{}, .nodes = &.{ .{ .constant = 0 }, }, .assertions = &.{.{ .scope = .closure_total, .measure = .retained, .relation = .exact, .expression = 0, }}, }, .overload = .{ .kind = .reject_before_seal, .detail = "count, name-byte, layout, or allocation failure returns before a durable product value is published", }, .risks = .{ .transitive = .{ .status = .witnessed, .detail = "graph queries read retained immutable revision records; teardown releases those handles after the local region", }, .foreign = .{ .status = .excluded, .detail = "product metadata construction and queries cross no operating-system or foreign callback boundary", }, }, .obligations = &.{ .{ .key = "choir_product_metadata_capacity", .role = .capacity_model }, .{ .key = "choir_product_metadata_acquisition", .role = .custom }, .{ .key = "choir_product_metadata_boundary", .role = .overload }, .{ .key = "choir_product_metadata_oom", .role = .overload }, .{ .key = "choir_product_graph_lifetime_transitive_risk", .role = .transitive_risk }, .{ .key = "choir_product_graph_lifetime_foreign_risk", .role = .foreign_risk }, .{ .key = "choir_product_refresh_lifetime", .role = .transitive_risk }, .{ .key = "choir_product_report_composition_lifetime", .role = .transitive_risk }, .{ .key = "choir_product_metadata_integration", .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, }, }, }, }; phase: alloc_phase.capacity.Phase, capacity: Capacity, bytes: [*]u8, pub fn init(allocator: Allocator, limits: Limits) InitError!Storage { const capacity = try Capacity.derive(limits); std.debug.assert(capacity.total_bytes > 0); const bytes = allocator.rawAlloc( capacity.total_bytes, capacity.allocation_alignment, @returnAddress(), ) orelse return error.OutOfMemory; return .{ .phase = .initialization, .capacity = capacity, .bytes = bytes, }; } pub fn region(self: *Storage, comptime T: type, comptime index: usize, count: usize) []T { comptime std.debug.assert(index < segment_count); std.debug.assert(self.phase == .initialization); const byte_length = std.math.mul(usize, count, @sizeOf(T)) catch unreachable; std.debug.assert(byte_length == self.capacity.byte_lengths[index]); std.debug.assert(@alignOf(T) == self.capacity.alignments[index].toByteUnits()); const offset = self.capacity.offsets[index]; const address = std.math.add(usize, @intFromPtr(self.bytes), offset) catch unreachable; const raw: [*]u8 = @ptrFromInt(address); const items: [*]T = @ptrCast(@alignCast(raw)); return items[0..count]; } pub fn activate(self: *Storage) void { std.debug.assert(self.phase == .initialization); self.phase = .steady; } pub fn status(self: *const Storage) alloc_phase.capacity.Phase { return self.phase; } pub fn deinit(self: *Storage, allocator: Allocator) void { std.debug.assert(self.phase != .teardown); self.phase = .teardown; allocator.rawFree( self.bytes[0..self.capacity.total_bytes], self.capacity.allocation_alignment, @returnAddress(), ); self.* = undefined; }};Source: lib/choir/src/product/root.zig
zig
pub const hashing = @import("hashing/root.zig");pub const incremental = @import("incremental.zig");pub const entity = @import("entity.zig");pub const operation = @import("operation.zig");pub const StableHasher = hashing.StableHasher;pub const StableValueNumbering = hashing.StableValueNumbering;pub const OperationFingerprintError = hashing.OperationFingerprintError;pub const operationFingerprint = hashing.operationFingerprint;pub const EntityNamespace = revision.record.Namespace;pub const EntityRef = revision.store.Entity;pub const EntityImage = entity.Image;pub const OperationProduct = operation.Product;pub const OperationJob = operation.Job;pub const OperationConfiguration = operation.Configuration;pub const Fingerprint = incremental.Fingerprint;pub const FingerprintBuilder = incremental.FingerprintBuilder;pub const ProductStamp = incremental.ProductStamp;pub const ProductRef = incremental.ProductRef;pub const ProductKey = incremental.ProductKey;pub const ProductDependency = incremental.ProductDependency;pub const ProductRefreshReason = incremental.ProductRefreshReason;pub const ProductMaterialization = incremental.ProductMaterialization;pub const ProductDependencyChange = incremental.ProductDependencyChange;pub const ProductRefreshDecision = incremental.ProductRefreshDecision;pub const ProductMetadataError = incremental.ProductMetadataError;pub const ProductRefreshPlan = incremental.ProductRefreshPlan;pub const ProductGraph = incremental.ProductGraph;pub const ProductGraphBuilderError = incremental.ProductGraphBuilderError;pub const ProductGraphBuilder = incremental.ProductGraphBuilder;pub const ProductRefreshReport = incremental.ProductRefreshReport;pub const productStamp = incremental.productStamp;pub const productRef = incremental.productRef;pub const cloneProductRef = incremental.cloneProductRef;pub const deinitProductRef = incremental.deinitProductRef;pub const productKey = incremental.productKey;pub const cloneProductKey = incremental.cloneProductKey;pub const deinitProductKey = incremental.deinitProductKey;pub const productDependency = incremental.productDependency;pub const derivedProductStamp = incremental.derivedProductStamp;pub const productRefsContain = incremental.productRefsContain;pub const fingerprintBytes = incremental.fingerprintBytes;pub const ProductMetadataStorage = @import("storage.zig").Storage;pub const revision = @import("revision/root.zig");pub const recipe = @import("recipe.zig");pub const compiler = @import("compiler.zig");Source: lib/choir/src/root.zig:33
zig
pub const product = @import("product/root.zig");Audit
| Definitions | 14 |
|---|---|
| Public names | 14 |
| Members | 9 |
| Version | 26.7.0 |
| Revision | daab053ee433 |