Expand description
Reference binary codec for the switchback artifact.
switchback-codec-pb implements [SwitchbackCodec] and
[SyncSwitchbackCodec] from switchback-traits using
buffa-generated types compiled from
switchback.proto
(canardleteer.switchback.v1alpha1). See ADR 0003
for wire-format policy.
§Protocol sub-schemas
Transport metadata uses ProtocolAttachment
envelopes on contract and entity nodes. Payload bytes encode one arm of a
protocol-package oneof; the core schema does not import those packages.
| Compiled proto | Generated Rust module |
|---|---|
protocol/http/v1alpha1/http.proto | canardleteer::switchback::protocol::http::v1alpha1 |
protocol/grpc/v1alpha1/grpc.proto | canardleteer::switchback::protocol::grpc::v1alpha1 |
protocol/grpc/v1alpha1/metadata_options.proto | same gRPC module (MethodOptions extension) |
protocol/kafka/v1alpha1/kafka.proto | canardleteer::switchback::protocol::kafka::v1alpha1 |
protocol/amqp/v1alpha1/amqp.proto | canardleteer::switchback::protocol::amqp::v1alpha1 |
protocol/mqtt/v1alpha1/mqtt.proto | canardleteer::switchback::protocol::mqtt::v1alpha1 |
Entity attachment matrix and decode steps: ADR 0011.
HTTP streaming and gRPC metadata authoring: ADR 0012.
Application code should prefer the
switchback-protocols
ProtocolRegistry for encode/decode.
§Example
use switchback_codec_pb::ProtobufCodec;
use switchback_traits::{ReferenceManual, SyncSwitchbackCodec};
let manual = ReferenceManual {
switchback_version: "v1alpha1".into(),
title: "Example".into(),
..Default::default()
};
let codec = ProtobufCodec;
let bytes = codec.serialize(&manual).unwrap();
let round_trip = codec.deserialize(&bytes).unwrap();
assert_eq!(round_trip.title, "Example");Wire message types live under canardleteer::switchback::v1alpha1.
Re-exports§
pub use convert::WIRE_VERSION;
Modules§
- canardleteer
- Buffa-generated protobuf types, namespaced by protobuf package path.
Protobuf package prefix
canardleteer.*. - convert
- Low-level protobuf conversion between seam model types and wire messages. Bidirectional mapping between seam model types and protobuf messages.
Structs§
- Protobuf
Codec - Reference protobuf codec using buffa-generated types from
canardleteer.switchback.v1alpha1.
Constants§
- DEFAULT_
SWITCHBACK_ FILENAME - Default on-disk filename for a switchback binary file.