Crate torvyn_types

Crate torvyn_types 

Source
Expand description

§torvyn-types

Shared foundation types for the Torvyn reactive streaming runtime.

This crate is the universal leaf dependency — every other Torvyn crate imports from it. It contains identity types, error types, domain enums, state machines, shared records, traits, and constants.

§Design principles

  • Zero internal dependencies: this crate depends only on std and serde.
  • Zero unsafe code: #![forbid(unsafe_code)].
  • Complete documentation: #![deny(missing_docs)].
  • Minimal footprint: compiles in under 2 seconds.

§Quick reference

Structs§

BufferHandle
Typed wrapper for buffer resources, built on ResourceId.
ComponentInstanceId
Runtime identity for a component instance within a host.
ComponentTypeId
Content-addressed identifier for a compiled component artifact.
ElementMeta
Metadata accompanying each stream element.
FlowId
Unique identifier for a flow (pipeline execution instance).
InvalidTransition
Error returned when an illegal state transition is attempted.
NoopEventSink
A no-op implementation of EventSink for testing and benchmarking.
ResourceId
Generational index into the resource table.
SpanId
W3C Trace Context span ID (64-bit / 8 bytes).
StreamId
Unique identifier for a stream connection within the reactor.
TraceContext
W3C Trace Context carried through a flow for distributed tracing.
TraceId
W3C Trace Context trace ID (128-bit / 16 bytes).
TransferRecord
Record of a data transfer for copy accounting and observability.

Enums§

BackpressurePolicy
Policy governing what happens when a stream queue is full.
BackpressureSignal
Backpressure signal from a consumer to the runtime.
ComponentRole
The role of a component within a pipeline topology.
ConfigError
Configuration errors.
ContractError
Contract validation errors.
CopyReason
The reason a data copy occurred, for copy accounting and observability.
EngineError
Engine errors for Wasm compilation and instantiation.
FlowState
Flow lifecycle state machine.
InvocationStatus
Status of a component invocation, for observability recording.
LinkError
Component linking errors.
ObservabilityLevel
Observability collection level, configurable at runtime.
PackagingError
Packaging and distribution errors.
ProcessError
Rust mapping of the WIT process-error variant.
ProcessErrorKind
Lightweight variant tag for ProcessError, used in observability paths where carrying the full error string is too expensive.
ReactorError
Reactor and scheduling errors.
ResourceError
Resource management errors.
ResourceState
Resource ownership state machine.
SecurityError
Security and capability errors.
Severity
Log severity level for diagnostic events.
TorvynError
Top-level error type aggregating all subsystem errors.

Constants§

DEFAULT_BUFFER_POOL_SIZE
Default buffer pool size per tier (number of buffers).
DEFAULT_COMPONENT_TIMEOUT_MS
Default component invocation timeout in milliseconds.
DEFAULT_COOPERATIVE_CANCEL_TIMEOUT_MS
Default cooperative cancellation timeout in milliseconds.
DEFAULT_DRAIN_TIMEOUT_MS
Default drain timeout in milliseconds.
DEFAULT_ELEMENTS_PER_YIELD
Default elements per yield at Normal priority.
DEFAULT_LOW_WATERMARK_RATIO
Default low watermark ratio for backpressure recovery.
DEFAULT_QUEUE_DEPTH
Default stream queue depth.
MAX_BUFFER_SIZE_BYTES
Maximum buffer size in bytes (global cap).
MAX_CONSECUTIVE_ELEMENTS_BEFORE_YIELD
Default maximum consecutive elements before a flow driver must yield.
MAX_HOT_PATH_NS
Maximum allowed per-element host-side overhead in nanoseconds.
MAX_OBSERVABILITY_DIAGNOSTIC_NS
Maximum allowed observability overhead at Diagnostic level, in nanoseconds.
MAX_OBSERVABILITY_PRODUCTION_NS
Maximum allowed observability overhead at Production level, in nanoseconds.
MIN_COMPATIBLE_VERSION
The minimum compatible Torvyn version for artifacts. Artifacts produced by versions older than this cannot be loaded.
TORVYN_VERSION
The current Torvyn runtime version (semver).

Traits§

EventSink
The hot-path trait for recording observability events.

Functions§

current_timestamp_ns
Returns the current wall-clock time as nanoseconds since the Unix epoch.

Type Aliases§

ComponentId
Type alias for ComponentInstanceId.