fleetforge_contracts/
lib.rs

1//! Generated gRPC contracts shared across FleetForge surfaces.
2
3pub mod artifacts {
4    use std::time::Duration;
5
6    use anyhow::Result;
7    use async_trait::async_trait;
8    use bytes::Bytes;
9    use serde::{Deserialize, Serialize};
10    use serde_json::Value;
11    use url::Url;
12
13    /// Metadata for a content-addressed artifact blob.
14    #[derive(Debug, Clone, Serialize, Deserialize)]
15    pub struct ArtifactMeta {
16        pub sha256: [u8; 32],
17        pub media_type: String,
18        pub size: u64,
19        pub metadata: Value,
20    }
21
22    /// Artifact storage abstraction shared across runtime surfaces.
23    #[async_trait]
24    pub trait ArtifactStore: Send + Sync {
25        async fn put(
26            &self,
27            bytes: Bytes,
28            media_type: &str,
29            metadata: Value,
30        ) -> Result<ArtifactMeta>;
31
32        async fn get(&self, sha256: [u8; 32]) -> Result<Bytes>;
33
34        async fn presign_get(&self, sha256: [u8; 32], ttl: Duration) -> Result<Url>;
35    }
36}
37
38pub mod runtime {
39    tonic::include_proto!("fleetforge.runtime.v1");
40
41    /// Encoded descriptor set used for reflection servers.
42    pub const FILE_DESCRIPTOR_SET: &[u8] =
43        include_bytes!(concat!(env!("OUT_DIR"), "/fleetforge.runtime.v1.bin"));
44}
45
46pub mod tap {
47    tonic::include_proto!("fleetforge.tap.v2");
48}
49
50pub use artifacts::{ArtifactMeta, ArtifactStore};
51pub use runtime::runtime_service_client::RuntimeServiceClient;
52pub use runtime::runtime_service_server::{RuntimeService, RuntimeServiceServer};
53pub use tap::tap_service_client::TapServiceClient;
54pub use tap::tap_service_server::{TapService, TapServiceServer};