pub trait RegistryClient: Send + Sync {
// Required methods
fn fetch_registry_data(
&self,
registry_url: &str,
path: &str,
) -> impl Future<Output = Result<Vec<u8>, NetworkError>> + Send;
fn push_registry_data(
&self,
registry_url: &str,
path: &str,
data: &[u8],
) -> impl Future<Output = Result<(), NetworkError>> + Send;
fn post_json(
&self,
registry_url: &str,
path: &str,
json_body: &[u8],
) -> impl Future<Output = Result<RegistryResponse, NetworkError>> + Send;
}Expand description
Fetches and pushes data to a remote registry service.
Implementations handle the transport protocol (e.g., HTTP, gRPC). The domain provides logical paths and receives raw bytes.
Usage:
ⓘ
use auths_core::ports::network::RegistryClient;
async fn sync_identity(client: &dyn RegistryClient, url: &str) {
let data = client.fetch_registry_data(url, "identities/abc123").await.unwrap();
}Required Methods§
Sourcefn fetch_registry_data(
&self,
registry_url: &str,
path: &str,
) -> impl Future<Output = Result<Vec<u8>, NetworkError>> + Send
fn fetch_registry_data( &self, registry_url: &str, path: &str, ) -> impl Future<Output = Result<Vec<u8>, NetworkError>> + Send
Fetches data from a registry at the given logical path.
Args:
registry_url: The registry service identifier.path: The logical path within the registry.
Usage:
ⓘ
let data = client.fetch_registry_data("registry.example.com", "identities/abc123").await?;Sourcefn push_registry_data(
&self,
registry_url: &str,
path: &str,
data: &[u8],
) -> impl Future<Output = Result<(), NetworkError>> + Send
fn push_registry_data( &self, registry_url: &str, path: &str, data: &[u8], ) -> impl Future<Output = Result<(), NetworkError>> + Send
Pushes data to a registry at the given logical path.
Args:
registry_url: The registry service identifier.path: The logical path within the registry.data: The raw bytes to push.
Usage:
ⓘ
client.push_registry_data("registry.example.com", "identities/abc123", &bytes).await?;Sourcefn post_json(
&self,
registry_url: &str,
path: &str,
json_body: &[u8],
) -> impl Future<Output = Result<RegistryResponse, NetworkError>> + Send
fn post_json( &self, registry_url: &str, path: &str, json_body: &[u8], ) -> impl Future<Output = Result<RegistryResponse, NetworkError>> + Send
POSTs a JSON payload to a registry endpoint and returns the raw response.
Args:
registry_url: Base URL of the registry service.path: The logical path within the registry (e.g.,"v1/identities").json_body: Serialized JSON bytes to send as the request body.
Usage:
ⓘ
let resp = client.post_json("https://registry.example.com", "v1/identities", &body).await?;
match resp.status {
201 => { /* success */ }
409 => { /* conflict */ }
_ => { /* error */ }
}Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.