tiny.machine.instance.types
Defined in instance.
API (19)
Actions
Public operations.
EventBatch.event: Decodes the event sitting at one index, counted from zero, so a caller can read what that event says.EventBatch.frames: Borrows the filled slots in the order the events arrived, so a caller can hash or forward a turn's events without the empty tail.
Types and contracts
Public types and contracts.
BackendAvailabilityBackendStageDoorbell: Holds one yield code read off the fixed machine doorbell port, so a caller receives the value a guest yield carries.EventBatch: Room for every event one instance doorbell produces, so draining a doorbell has somewhere to put what comes out.ExecutionFingerprintExit: Reports one execution boundary in the form a caller sees, so everyrunanswers with this value and the answer decides whether the lifecycle goes on.Fault: Presents one terminal fault in a single shape across backends, so a caller reads the details once a run has ended in a fault.FaultKind: Records where a terminal execution fault came from, so a fault that ends a run states its source.Input: Gathers everything one cold start of a K0 guest needs into one value, so a caller supplies all of this at once and knows how long to keep the image and the manifest around.K0State: The state K0 owns and keeps when it is reactivated, so a receipt carries the state the guest keeps across reactivation.QuiescenceReceipt: The checkable evidence for one quiescent turn a caller has acknowledged, so a caller holds the evidence one settled turn leaves behind.RestoreInput: Gathers everything needed to bring a checkpoint back into RAM the caller owns, so a caller supplies all of this at once for a restore.RunPhase: Represents the stage of one lifecycle as a caller can observe it, so the caller knows which lifecycle calls are legal at this moment.SettledTransport: The two ring positions at a settled guest boundary, which are equal there, so a caller reading a receipt learns where the transport stood when the guest came to rest.SharedRestoreInput: Gathers everything needed for a portable restore whose pages come from an immutable root provider, so the caller supplies a provider and branch storage.Unavailable
Values and defaults
Public values and defaults.
Source
Source: lib/machine/src/instance/receipt/types.zig:14
zig
/// Room for every event one instance doorbell produces, so draining a doorbell/// has somewhere to put what comes out. The count field says how many of those/// slots are filled. The value holds the encoded message bytes itself. There/// are four slots, matching the number of events K0 sends for one terminal/// input.pub const EventBatch = struct { count: u8, storage: [event_batch_max]os.abi.MessageWire, /// Borrows the filled slots in the order the events arrived, so a caller /// can hash or forward a turn's events without the empty tail. The count /// never runs past `event_batch_max`. pub fn frames(self: *const EventBatch) []const os.abi.MessageWire { std.debug.assert(self.count <= self.storage.len); return self.storage[0..self.count]; } /// Decodes the event sitting at one index, counted from zero, so a caller /// can read what that event says. A count or index out of range comes back /// as `EventIndexOutOfBounds`. Bytes that will not decode come back as a /// message error. pub fn event( self: *const EventBatch, index: usize, ) (os.abi.message.Error || error{EventIndexOutOfBounds})!DecodedEvent { if (self.count > self.storage.len or index >= self.count) { return error.EventIndexOutOfBounds; } return os.abi.decodeEvent(&self.storage[index]); }};Source: lib/machine/src/instance/receipt/types.zig:52
zig
/// The state K0 owns and keeps when it is reactivated, so a receipt carries the/// state the guest keeps across reactivation. The counter holds how many/// terminal-input turns have finished.pub const K0State = struct { counter: u8,};Source: lib/machine/src/instance/receipt/types.zig:44
zig
/// The two ring positions at a settled guest boundary, which are equal there,/// so a caller reading a receipt learns where the transport stood when the/// guest came to rest.pub const SettledTransport = struct { request_cursor: u64, event_cursor: u64,};Source: lib/machine/src/instance/receipt/types.zig:7
zig
pub const event_batch_max: usize = os.k0.events_per_terminal_input;Source: lib/machine/src/instance/root.zig:98
zig
pub const types = @import("types.zig");Source: lib/machine/src/instance/types.zig
zig
const core = @import("machine_instance_core");const os = @import("os");const admission = @import("../admission/root.zig");const checkpoint = @import("../checkpoint/root.zig");const profile = @import("../profile/root.zig");const receipt = @import("receipt/root.zig");pub const BackendAvailability = core.backend.BackendAvailability;pub const BackendStage = core.backend.BackendStage;pub const Unavailable = core.backend.Unavailable;pub const EventBatch = receipt.EventBatch;pub const ExecutionFingerprint = receipt.ExecutionFingerprint;pub const K0State = receipt.K0State;pub const QuiescenceReceipt = receipt.QuiescenceReceipt;pub const SettledTransport = receipt.SettledTransport;pub const event_batch_max = receipt.event_batch_max;/// Gathers everything one cold start of a K0 guest needs into one value, so a/// caller supplies all of this at once and knows how long to keep the image and/// the manifest around. The profile inside it decides which backend runs and/// under which execution rules. The caller keeps ownership of both slices and/// may free them once `Instance.init` has returned.pub const Input = struct { profile: profile.Profile, elf: []const u8, execution_manifest: []const u8, expected_execution_fingerprint: ExecutionFingerprint, fence: os.abi.ActivationFence, initial_time_tick: u64, entropy_generation: u64, terminal_offset: u64, effect_frontier: u64, block_root: os.abi.Digest, source_root: os.abi.Digest, input_frontier: u64, terminal_input_offset: u64, outstanding_effect: ?admission.EffectRequest,};/// Gathers everything needed to bring a checkpoint back into RAM the caller/// owns, so a caller supplies all of this at once for a restore. The checkpoint/// source and the manifest stay the caller's, borrowed only for the length of/// the `Instance.restore` call.pub const RestoreInput = struct { checkpoint: checkpoint.Source, expected_root: checkpoint.Root, profile: profile.Profile, execution_manifest: []const u8, fence: os.abi.ActivationFence,};/// Gathers everything needed for a portable restore whose pages come from an/// immutable root provider, so the caller supplies a provider and branch/// storage. The provider and the branch storage arrive as their own arguments/// to `Instance.restoreShared`. The instance holds the memory behind both until/// `deinit`.pub const SharedRestoreInput = struct { expected_root: checkpoint.roots.ManifestRoot, profile: profile.Profile, execution_manifest: []const u8, fence: os.abi.ActivationFence,};/// Holds one yield code read off the fixed machine doorbell port, so a caller/// receives the value a guest yield carries.pub const Doorbell = struct { code: os.abi.channel.DoorbellCode };/// Represents the stage of one lifecycle as a caller can observe it, so the/// caller knows which lifecycle calls are legal at this moment. A lifecycle/// call takes some stages and answers with a protocol error in the rest.pub const RunPhase = enum(u8) { closed, booting, draining_activation, awaiting_input, input_delivered, draining_input, awaiting_acknowledgement, awaiting_reactivation, capturing_checkpoint, completing_io, failed,};/// Records where a terminal execution fault came from, so a fault that ends a/// run states its source. The eight sources are device, exception, entry,/// memory, hypercall, debug, system, and backend.pub const FaultKind = enum(u8) { device, exception, entry, memory, hypercall, debug, system, backend,};/// Presents one terminal fault in a single shape across backends, so a caller/// reads the details once a run has ended in a fault. The code and address/// fields hold whatever the backend reported for that kind of fault.pub const Fault = struct { kind: FaultKind, code: u64, address: u64,};/// Reports one execution boundary in the form a caller sees, so every `run`/// answers with this value and the answer decides whether the lifecycle goes/// on. A ready or quiescent yield moves the lifecycle to its next stage. A/// halt, a shutdown, a fault, and every other yield code end execution for that/// lifecycle.pub const Exit = union(enum) { doorbell: Doorbell, halted, shutdown, fault: Fault,};Audit
| Definitions | 14 |
|---|---|
| Public names | 27 |
| Members | 28 |
| Version | 26.7.0 |
| Revision | daab053ee433 |