Skip to main content

appcore_control_plane/
offline.rs

1// =============================================================================
2//        #######
3//     ###       ###     F: offline.rs
4//    ##   ## ##   ##    P: AppCore-Runtime
5//         ## ##
6//                       C: 2026/07/22 15:41:18 by dnettoRaw
7//    ##   ## ##   ##    U: 2026/07/24 16:07:49 by dnettoRaw
8//      ###########      S: 1.0.1-rc.8
9// =============================================================================
10
11use super::*;
12
13/// Client that explicitly reports the control plane as unavailable.
14#[derive(Debug, Clone, Copy, Default)]
15pub struct OfflineControlPlaneClient;
16
17impl ControlPlaneProvider for OfflineControlPlaneClient {
18    fn register<'a>(
19        &'a self,
20        _registration: CoreRegistration,
21    ) -> ControlPlaneFuture<'a, CorePresence> {
22        Box::pin(async { Err(ControlPlaneError::Offline) })
23    }
24
25    fn heartbeat<'a>(
26        &'a self,
27        _request: HeartbeatRequest,
28    ) -> ControlPlaneFuture<'a, HeartbeatResponse> {
29        Box::pin(async { Err(ControlPlaneError::Offline) })
30    }
31
32    fn discover_peers<'a>(
33        &'a self,
34        _identity: &'a CoreIdentity,
35    ) -> ControlPlaneFuture<'a, PeerDirectory> {
36        Box::pin(async { Err(ControlPlaneError::Offline) })
37    }
38
39    fn acquire_or_renew_service_lease<'a>(
40        &'a self,
41        _identity: &'a CoreIdentity,
42        _service_id: &'a ServiceId,
43        _ttl_ms: u64,
44        _now_ms: u64,
45    ) -> ControlPlaneFuture<'a, ServiceLeaderLease> {
46        Box::pin(async { Err(ControlPlaneError::Offline) })
47    }
48
49    fn release_service_lease<'a>(
50        &'a self,
51        _lease: ServiceLeaderLease,
52    ) -> ControlPlaneFuture<'a, ()> {
53        Box::pin(async { Err(ControlPlaneError::Offline) })
54    }
55}