Skip to main content

Module protocol_v2

Module protocol_v2 

Source
Expand description

v2 broker protocol module.

Houses the prost-generated types for the running_process.broker.v2 package — currently the ServiceDefinition envelope and the HttpServerCapability optional sub-message introduced in #483.

v2 runs in parallel with v1 (super::protocol) through the broker v2 rollout; v1’s types are FROZEN FOREVER (#228) so all new capability fields land here instead.

Modules§

backend_handle
v2 backend-handle namespace (slice 23-B of zccache#782).
client_compat
v1-client compatibility surface under the v2 namespace (slice 25-A of zccache#782).

Structs§

BackendHttpReady
Notification frame sent from a daemon to its broker once the daemon’s HTTP server has bound a port. port is u16 in Rust; proto’s narrowest integer is uint32 so the wire type is uint32 and the broker validates the range on receipt.
CacheManifest
v2 cache manifest envelope.
CacheManifestBuilder
Builder for CacheManifest. Mirrors v1’s super::super::builders::CacheManifestBuilder API verbatim so the consumer-side migration is a literal s/v1::/v2::/ swap.
CacheRoot
One cache root the daemon exposes. v2 mirrors v1’s shape so the CacheManifestBuilder API is identical at the call site.
GetBrokerHttpEndpointRequest
CLI→broker request for the broker’s own HTTP endpoint. Empty marker — no fields are necessary; the broker fronts exactly one HTTP server.
GetBrokerHttpEndpointResponse
Broker→CLI response carrying the resolved HTTP endpoint. port is the port the broker is currently bound on (after env-override / config resolution per #483 §3); pid is the broker’s process id, included so a mid-restart consumer can distinguish a stale answer from a live one without needing a separate liveness probe.
HttpServerCapability
Optional per-backend HTTP server capability.
ServiceDefinition
v2 service definition envelope.
ServiceDefinitionBuilder
Builder for ServiceDefinition.
ServiceDefinitionLoader
Loader rooted at one v2 service-definition directory.
ServiceDefinitionScanEntry
Result of scanning one v2 service-definition entry.

Enums§

BrokerIsolation
Broker isolation mode for a service.
CacheRootKind
Logical role classification for cache roots. Wire values mirror v1’s broker_v1.CacheRootKind EXACTLY (see broker_v1_manifest.proto). Keeping the integer values aligned avoids subtle bugs when consumers mix the two generations (e.g. via as i32 casts in test fixtures or in code that bridges between v1 and v2). New kinds land in the reserved range; v1’s enum is FROZEN so anything past 9 is v2-only.

Constants§

BROKER_ENVELOPE_VERSION_V2
Constant carried in every v2 manifest’s CacheManifest::broker_envelope_version field. Pins the schema generation from the proto side independently of the file name.
CENTRAL_MANIFEST_EXTENSION_V2
v2 file extension used for entries in the central manifest registry. Mirrors v1’s pb extension with a v2.pb distinguisher.
ROOT_MANIFEST_FILE_V2
v2 file name written inside <cache_root>/. Distinct from v1’s .running-process-manifest.pb so a v1 broker never decodes a v2 file by accident (and vice versa).
SERVICE_DEF_V2_EXTENSION
v2 service-definition file extension. Distinct from v1’s servicedef so a v1 broker never accidentally tries to decode a v2 file (and vice versa).

Functions§

central_manifest_path_v2
Compute the v2 central-registry file path for one (service, version) pair. Mirrors v1’s central_manifest_path with the .v2.pb suffix.
central_registry_dir_v2
Return the platform central-registry directory (same path as v1).
service_definition_dir_v2
Return the v2 service-definition directory.
service_definition_path_v2
Compute the v2 file path for one service definition.
write_service_definition_v2
Validate and write one .servicedef.v2 file into root.
write_to_central_in_dir_v2
Testable variant of write_to_central_v2 with an explicit registry directory (tests, custom layouts).
write_to_central_v2
Write <central_registry>/{service}-{version}.v2.pb atomically.
write_to_root_v2
Write <cache_root>/.running-process-manifest.v2.pb atomically.