Skip to main content

Crate hyprstream_workers

Crate hyprstream_workers 

Source
Expand description

hyprstream-workers: Isolated workload execution using Kata Containers

This crate provides CRI-aligned (Kubernetes Container Runtime Interface) services for running isolated workloads in Kata Container VMs with GitHub Actions-compatible workflow orchestration.

§Architecture

Two main services:

  • WorkerService: AGPL implementation of the canonical worker contracts

    • PodSandbox = Kata VM (maps to CRI sandbox concept)
    • Container = OCI container within VM
    • Image operations backed by Nydus RAFS for chunk-level deduplication
  • WorkflowService: High-level workflow orchestration

    • Discovers .github/workflows/*.yml from RegistryService repos
    • Subscribes to event bus for automatic triggers
    • Spawns pods/containers via WorkerService

§Event Bus

Uses XPUB/XSUB proxy pattern with repo-scoped topics:

  • git2db.{repo_id}.push - Repository push events
  • training.{model_id}.completed - Training completion events
  • metrics.{model_id}.breach - Threshold breach events

§Example

ⓘ
use hyprstream_workers::WorkerService;

// Create worker service
let worker = WorkerService::new(config).await?;

// Pull an image
let image_id = worker.pull_image(&ImageSpec::new("alpine:latest"), None).await?;

// Create a pod sandbox (Kata VM)
let sandbox_id = worker.run_pod_sandbox(&PodSandboxConfig::default()).await?;

// Create and start a container
let container_id = worker.create_container(&sandbox_id, &container_config, &sandbox_config).await?;
worker.start_container(&container_id).await?;

Re-exports§

pub use config::HypervisorType;
pub use config::ImageConfig;
pub use config::PoolConfig;
pub use config::WorkerConfig;
pub use config::WorkflowConfig;
pub use error::WorkerError;
pub use runtime::NspawnBackend;
pub use runtime::NspawnConfig;
pub use runtime::SandboxBackend;
pub use runtime::SandboxHandle;
pub use runtime::WorkerService;
pub use runtime::resolve_backend;
pub use runtime::BackendCtx;
pub use runtime::BackendRegistration;
pub use runtime::KataBackend;
pub use runtime::explain_selection;
pub use runtime::BackendCandidate;
pub use image::RafsStore;
pub use image::ImageBackendRegistration;
pub use image::ImageStore;
pub use events::serialize_container_started;
pub use events::serialize_container_stopped;
pub use events::serialize_sandbox_started;
pub use events::serialize_sandbox_stopped;
pub use events::ContainerStarted;
pub use events::ContainerStopped;
pub use events::ReceivedEvent;
pub use events::SandboxStarted;
pub use events::SandboxStopped;
pub use events::WorkerEvent;
pub use workflow::WorkflowService;

Modules§

annotations_capnp
common_capnp
config
Configuration types for hyprstream-workers
dbus
D-Bus bridge for container access to host services
error
Error types for hyprstream-workers
events
Event bus infrastructure — moq-lite backed (#167).
generated
Generated RPC dispatch code from generate_rpc_service! proc macro.
image
CRI image service implementation with Dragonfly-native blob fetching
paths
Runtime path resolution for system vs user mode
runtime
CRI runtime service implementation
streaming_capnp
workflow
WorkflowService - GitHub Actions compatible workflow orchestration

Structs§

MoqEventOrigin
Shared moq origin for the event bus plane.

Functions§

init_global_moq_event_origin
Register the process-global moq event bus origin.