Skip to main content

synapse_application/
mutation_ports.rs

1use std::sync::Arc;
2
3use soma_fleet::HostRepository;
4use soma_infra::{
5    BuildContextInspector, ComposeBuildMutator, ComposeDownClient, ComposeMutationClient,
6    ComposePullClient, ComposeRecreateClient, ContainerExecClientProvider,
7    ContainerRecreateClientProvider, DockerArtifactClientProvider, DockerCleanupClientProvider,
8    DockerMutationClientProvider, HostExecMutator, ImageBuildMutator, VerifiedFileTransferClient,
9};
10
11/// Product-owned privileged build ports.
12pub struct SynapseBuildPorts {
13    /// Descriptor-confined build-context inspector.
14    pub contexts: Arc<dyn BuildContextInspector>,
15    /// Docker image build driver.
16    pub image: Arc<dyn ImageBuildMutator>,
17    /// Compose build driver.
18    pub compose: Arc<dyn ComposeBuildMutator>,
19}
20
21/// Product-owned replacement ports.
22pub struct SynapseRecreatePorts {
23    /// Host-bound container replacement client provider.
24    pub containers: Arc<dyn ContainerRecreateClientProvider>,
25    /// Compose force-recreate client.
26    pub compose: Arc<dyn ComposeRecreateClient>,
27}
28
29/// Product-owned bounded execution ports.
30pub struct SynapseExecPorts {
31    /// Host-bound Docker exec client provider.
32    pub containers: Arc<dyn ContainerExecClientProvider>,
33    /// Allowlisted descriptor-bound host command driver.
34    pub hosts: Arc<dyn HostExecMutator>,
35    /// Maximum in-flight fanout targets.
36    pub max_fanout_concurrency: usize,
37}
38
39/// Product-owned ports for final cleanup and transfer mutations.
40pub struct SynapseFinalPorts {
41    /// Host-bound Docker cleanup client provider.
42    pub cleanup: Arc<dyn DockerCleanupClientProvider>,
43    /// Compose teardown client.
44    pub compose_down: Arc<dyn ComposeDownClient>,
45    /// Verified bounded file-transfer client.
46    pub transfer: Arc<dyn VerifiedFileTransferClient>,
47}
48
49/// Product-owned ports used by canonical Synapse mutations.
50pub struct SynapseMutationPorts {
51    /// Fleet topology source.
52    pub hosts: Arc<dyn HostRepository>,
53    /// Host-bound Docker mutation client provider.
54    pub docker: Arc<dyn DockerMutationClientProvider>,
55    /// Optional Compose lifecycle mutation client.
56    pub compose: Option<Arc<dyn ComposeMutationClient>>,
57    /// Optional Docker artifact mutation client provider.
58    pub artifacts: Option<Arc<dyn DockerArtifactClientProvider>>,
59    /// Optional Compose artifact mutation client.
60    pub compose_pull: Option<Arc<dyn ComposePullClient>>,
61    /// Optional privileged build ports.
62    pub builds: Option<SynapseBuildPorts>,
63    /// Optional destructive replacement ports.
64    pub recreate: Option<SynapseRecreatePorts>,
65    /// Optional bounded execution ports.
66    pub exec: Option<SynapseExecPorts>,
67    /// Optional final cleanup and transfer ports.
68    pub final_mutations: Option<SynapseFinalPorts>,
69}
70
71#[cfg(test)]
72#[path = "mutation_ports_tests.rs"]
73mod tests;