tiny.zen.DiagramDocumentPlan
Defined in tiny.zen.
API (10)
Actions
Public operations.
Fields and members
Public fields and members.
Source
Source: lib/zen/src/diagram/document/plan.zig:13
zig
pub const Plan = struct { source_bytes: usize, source_hash: u64, line_scratch_bytes: usize, document_bytes: usize, surveyed: diagram_limits.Limits, pub fn inspect(line_scratch: []u8, jsonl: []const u8) model.Error!Plan { const line_scratch_bytes = try requiredLineScratchBytes(jsonl); if (line_scratch_bytes > line_scratch.len) { return error.DiagramLineScratchCapacityExceeded; } const surveyed = try diagram_limits.survey( line_scratch[0..line_scratch_bytes], jsonl, ); const derived = try diagram_limits.Capacity.derive(surveyed); return .{ .source_bytes = jsonl.len, .source_hash = std.hash.Wyhash.hash(0, jsonl), .line_scratch_bytes = line_scratch_bytes, .document_bytes = try regionLength(derived.document_bytes), .surveyed = surveyed, }; } pub fn requiredLineScratchBytes(jsonl: []const u8) error{DiagramTooLarge}!usize { const measured = diagram_limits.measure(jsonl); return regionLength(try diagram_limits.lineScratchBytes(measured.max_line_bytes)); } pub fn exactLimits(self: Plan) Limits { return .{ .max_line_scratch_bytes = self.line_scratch_bytes, .max_document_bytes = self.document_bytes, }; } pub fn require(self: Plan, limits: Limits) model.Exhaustion!void { if (self.line_scratch_bytes > limits.max_line_scratch_bytes) { return error.DiagramLineScratchCapacityExceeded; } if (self.document_bytes > limits.max_document_bytes) { return error.DiagramDocumentCapacityExceeded; } } pub fn matches(self: Plan, jsonl: []const u8) bool { return self.source_bytes == jsonl.len and self.source_hash == std.hash.Wyhash.hash(0, jsonl); }};Source: lib/zen/src/root.zig:47
zig
/// Exact diagram-document demand measured before storage acquisition.pub const DiagramDocumentPlan = diagram.DocumentPlan;Also reachable as
diagram.DocumentPlan, diagram.document.Plan.
Audit
| Definitions | 6 |
|---|---|
| Public names | 18 |
| Members | 5 |
| Version | 26.7.0 |
| Revision | daab053ee433 |