Skip to main content

ControlPlaneProvider

Trait ControlPlaneProvider 

Source
pub trait ControlPlaneProvider: Send + Sync {
    // Required methods
    fn register<'a>(
        &'a self,
        registration: CoreRegistration,
    ) -> Pin<Box<dyn Future<Output = Result<CorePresence, ControlPlaneError>> + Send + 'a>>;
    fn heartbeat<'a>(
        &'a self,
        request: HeartbeatRequest,
    ) -> Pin<Box<dyn Future<Output = Result<HeartbeatResponse, ControlPlaneError>> + Send + 'a>>;
    fn discover_peers<'a>(
        &'a self,
        identity: &'a CoreIdentity,
    ) -> Pin<Box<dyn Future<Output = Result<PeerDirectory, ControlPlaneError>> + Send + 'a>>;
    fn acquire_or_renew_service_lease<'a>(
        &'a self,
        identity: &'a CoreIdentity,
        service_id: &'a ServiceId,
        ttl_ms: u64,
        now_ms: u64,
    ) -> Pin<Box<dyn Future<Output = Result<ServiceLeaderLease, ControlPlaneError>> + Send + 'a>>;
    fn release_service_lease<'a>(
        &'a self,
        lease: ServiceLeaderLease,
    ) -> Pin<Box<dyn Future<Output = Result<(), ControlPlaneError>> + Send + 'a>>;

    // Provided methods
    fn register_traced<'a>(
        &'a self,
        registration: CoreRegistration,
        _trace: Option<&'a TraceContext>,
    ) -> Pin<Box<dyn Future<Output = Result<CorePresence, ControlPlaneError>> + Send + 'a>> { ... }
    fn heartbeat_traced<'a>(
        &'a self,
        request: HeartbeatRequest,
        _trace: Option<&'a TraceContext>,
    ) -> Pin<Box<dyn Future<Output = Result<HeartbeatResponse, ControlPlaneError>> + Send + 'a>> { ... }
    fn discover_peers_traced<'a>(
        &'a self,
        identity: &'a CoreIdentity,
        _trace: Option<&'a TraceContext>,
    ) -> Pin<Box<dyn Future<Output = Result<PeerDirectory, ControlPlaneError>> + Send + 'a>> { ... }
    fn acquire_or_renew_service_lease_traced<'a>(
        &'a self,
        identity: &'a CoreIdentity,
        service_id: &'a ServiceId,
        ttl_ms: u64,
        now_ms: u64,
        _trace: Option<&'a TraceContext>,
    ) -> Pin<Box<dyn Future<Output = Result<ServiceLeaderLease, ControlPlaneError>> + Send + 'a>> { ... }
    fn release_service_lease_traced<'a>(
        &'a self,
        lease: ServiceLeaderLease,
        _trace: Option<&'a TraceContext>,
    ) -> Pin<Box<dyn Future<Output = Result<(), ControlPlaneError>> + Send + 'a>> { ... }
}
Expand description

Provider contract for presence, discovery and leadership coordination.

Required Methods§

Source

fn register<'a>( &'a self, registration: CoreRegistration, ) -> Pin<Box<dyn Future<Output = Result<CorePresence, ControlPlaneError>> + Send + 'a>>

Registers a running core.

Source

fn heartbeat<'a>( &'a self, request: HeartbeatRequest, ) -> Pin<Box<dyn Future<Output = Result<HeartbeatResponse, ControlPlaneError>> + Send + 'a>>

Reports liveness and current mode.

Source

fn discover_peers<'a>( &'a self, identity: &'a CoreIdentity, ) -> Pin<Box<dyn Future<Output = Result<PeerDirectory, ControlPlaneError>> + Send + 'a>>

Discovers compatible peers.

Source

fn acquire_or_renew_service_lease<'a>( &'a self, identity: &'a CoreIdentity, service_id: &'a ServiceId, ttl_ms: u64, now_ms: u64, ) -> Pin<Box<dyn Future<Output = Result<ServiceLeaderLease, ControlPlaneError>> + Send + 'a>>

Acquires or renews leadership independently for one service.

Source

fn release_service_lease<'a>( &'a self, lease: ServiceLeaderLease, ) -> Pin<Box<dyn Future<Output = Result<(), ControlPlaneError>> + Send + 'a>>

Releases leadership for one service.

Provided Methods§

Source

fn register_traced<'a>( &'a self, registration: CoreRegistration, _trace: Option<&'a TraceContext>, ) -> Pin<Box<dyn Future<Output = Result<CorePresence, ControlPlaneError>> + Send + 'a>>

Registers a core while propagating trace context when supported.

Source

fn heartbeat_traced<'a>( &'a self, request: HeartbeatRequest, _trace: Option<&'a TraceContext>, ) -> Pin<Box<dyn Future<Output = Result<HeartbeatResponse, ControlPlaneError>> + Send + 'a>>

Sends a heartbeat while propagating trace context when supported.

Source

fn discover_peers_traced<'a>( &'a self, identity: &'a CoreIdentity, _trace: Option<&'a TraceContext>, ) -> Pin<Box<dyn Future<Output = Result<PeerDirectory, ControlPlaneError>> + Send + 'a>>

Discovers peers while propagating trace context when supported.

Source

fn acquire_or_renew_service_lease_traced<'a>( &'a self, identity: &'a CoreIdentity, service_id: &'a ServiceId, ttl_ms: u64, now_ms: u64, _trace: Option<&'a TraceContext>, ) -> Pin<Box<dyn Future<Output = Result<ServiceLeaderLease, ControlPlaneError>> + Send + 'a>>

Acquires a service lease while propagating trace context when supported.

Source

fn release_service_lease_traced<'a>( &'a self, lease: ServiceLeaderLease, _trace: Option<&'a TraceContext>, ) -> Pin<Box<dyn Future<Output = Result<(), ControlPlaneError>> + Send + 'a>>

Releases a service lease while propagating trace context when supported.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§