pub trait Provider: Send + Sync {
// Required methods
fn capabilities(&self) -> Capabilities;
fn wake<'a>(
&'a self,
deployment: &'a DeploymentRef,
replicas: u32,
) -> BoxFuture<'a, Result<Vec<Endpoint>, ProviderError>>;
fn release<'a>(
&'a self,
replica: &'a ReplicaRef,
mode: ReleaseMode,
) -> BoxFuture<'a, Result<(), ProviderError>>;
fn list<'a>(
&'a self,
deployment: &'a DeploymentRef,
) -> BoxFuture<'a, Result<Vec<ReplicaState>, ProviderError>>;
// Provided method
fn invoke<'a>(
&'a self,
_endpoint: &'a Endpoint,
_request: InvokeRequest,
) -> Option<BoxFuture<'a, Result<InvokeResponse, ProviderError>>> { ... }
}Expand description
Run-time operations only: wake, release, list. Creating or updating a
deployment is graphrt deploy’s job with deploy-time credentials
(DeployDriver); the gateway’s credentials can only wake / scale / stop / list.
Contract (checked by the conformance harness):
wake(d, n)is idempotent and absolute: it makes at leastnreplicas ofdready and returns the endpoints of all ready replicas (≥n). Twenty concurrentwake(d, 1)from zero end with one replica (C1). ForAddressing::Urlit may be a no-op returning the one URL.release(r, mode)gives back exactlyr; releasing a replica that is already gone isOk. ForAddressing::Urlit is a no-op.list(d)reports every replica the provider knows ford, including ones the gateway did not start (reconciliation, C5 and C12).- Errors are classified (
crate::ProviderErrorKind); credentials never appear in errors or logs (C8, C10).
Required Methods§
Sourcefn capabilities(&self) -> Capabilities
fn capabilities(&self) -> Capabilities
Static capabilities.
Sourcefn wake<'a>(
&'a self,
deployment: &'a DeploymentRef,
replicas: u32,
) -> BoxFuture<'a, Result<Vec<Endpoint>, ProviderError>>
fn wake<'a>( &'a self, deployment: &'a DeploymentRef, replicas: u32, ) -> BoxFuture<'a, Result<Vec<Endpoint>, ProviderError>>
Ensures at least replicas ready replicas and returns their endpoints.
Sourcefn release<'a>(
&'a self,
replica: &'a ReplicaRef,
mode: ReleaseMode,
) -> BoxFuture<'a, Result<(), ProviderError>>
fn release<'a>( &'a self, replica: &'a ReplicaRef, mode: ReleaseMode, ) -> BoxFuture<'a, Result<(), ProviderError>>
Releases one replica (Suspend, Stop or ScaleIn).
Sourcefn list<'a>(
&'a self,
deployment: &'a DeploymentRef,
) -> BoxFuture<'a, Result<Vec<ReplicaState>, ProviderError>>
fn list<'a>( &'a self, deployment: &'a DeploymentRef, ) -> BoxFuture<'a, Result<Vec<ReplicaState>, ProviderError>>
Lists the replicas of a deployment version for reconciliation.
Provided Methods§
Sourcefn invoke<'a>(
&'a self,
_endpoint: &'a Endpoint,
_request: InvokeRequest,
) -> Option<BoxFuture<'a, Result<InvokeResponse, ProviderError>>>
fn invoke<'a>( &'a self, _endpoint: &'a Endpoint, _request: InvokeRequest, ) -> Option<BoxFuture<'a, Result<InvokeResponse, ProviderError>>>
Sends a gateway → agent request through the platform instead of HTTP
(see crate::invoke). None (the default) means the endpoint is
reached over HTTP at its address.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".