pub struct ProtobufEngine;Expand description
The Protobuf projection engine.
This struct provides methods to convert a SEA Graph into Protobuf IR
which can then be serialized to .proto text format.
Implementations§
Source§impl ProtobufEngine
impl ProtobufEngine
Sourcepub fn project_with_options(
graph: &Graph,
namespace: &str,
package: &str,
projection_name: &str,
include_governance: bool,
) -> ProtoFile
pub fn project_with_options( graph: &Graph, namespace: &str, package: &str, projection_name: &str, include_governance: bool, ) -> ProtoFile
Project with options for a projection contract.
Sourcepub fn project_with_full_options(
graph: &Graph,
namespace: &str,
package: &str,
projection_name: &str,
include_governance: bool,
include_services: bool,
) -> ProtoFile
pub fn project_with_full_options( graph: &Graph, namespace: &str, package: &str, projection_name: &str, include_governance: bool, include_services: bool, ) -> ProtoFile
Project with all options including gRPC service generation.
Sourcepub fn project_multi_file(
graph: &Graph,
base_package: &str,
include_governance: bool,
include_services: bool,
) -> BTreeMap<PathBuf, ProtoFile>
pub fn project_multi_file( graph: &Graph, base_package: &str, include_governance: bool, include_services: bool, ) -> BTreeMap<PathBuf, ProtoFile>
Project a SEA Graph to multiple ProtoFiles (one per namespace).
This method partitions the graph by namespace, creating a separate .proto file
for each. Cross-namespace references are automatically resolved by adding imports
and fully qualifying type names.
§Arguments
graph- The semantic graph to projectbase_package- The root package name (e.g. “sea.generated”)include_governance- Whether to include governance messagesinclude_services- Whether to generate gRPC services
§Returns
A map of relative file paths to ProtoFile definitions.
Sourcepub fn flows_to_services(graph: &Graph, namespace: &str) -> Vec<ProtoService>
pub fn flows_to_services(graph: &Graph, namespace: &str) -> Vec<ProtoService>
This method groups flows by their destination entity (service provider)
and creates RPC methods for each flow. The naming convention follows
gRPC best practices: {DestinationEntity}Service.
§Example
A flow Customer -> PaymentProcessor of PaymentRequest generates:
service PaymentProcessorService {
rpc ProcessPaymentRequest(PaymentRequest) returns (PaymentRequestResponse);
}