Skip to main content

Module builders

Module builders 

Source
Expand description

Ergonomic builders for the two registration messages a consumer must produce to join the broker: ServiceDefinition and CacheManifest (#433 R2).

The wire types are prost-generated structs with ~10-16 fields each, most of which a consumer leaves at their defaults. Hand-constructing them means spelling out every field (and re-deriving the boilerplate the broker already owns: media type, schema version, host identity, timestamps, self-digest). These builders set the required fields, default the rest, validate on build, and optionally persist via the existing central-registry helpers.

use running_process::broker::builders::{CacheManifestBuilder, ServiceDefinitionBuilder};
use running_process::broker::protocol::CacheRootKind;

// Register the service the broker spawns/negotiates.
ServiceDefinitionBuilder::shared_broker("zccache", "/usr/local/bin/zccache")
    .min_version("1.10.0")
    .allow_version("1.11.20")
    .install()?;

// Publish the daemon's cache manifest into the central registry.
CacheManifestBuilder::new("zccache", "1.11.20")
    .broker_instance("shared")
    .root(CacheRootKind::CacheData, "/var/cache/zccache")
    .publish()?;

Structsยง

CacheManifestBuilder
Fluent builder for a CacheManifest.
ServiceDefinitionBuilder
Fluent builder for a ServiceDefinition.