Skip to main content

reddb_server/application/
ports_impls_native.rs

1use super::*;
2use crate::RedDBError;
3impl RuntimeNativePort for RedDBRuntime {
4    fn health_report(&self) -> crate::health::HealthReport {
5        self.health()
6    }
7
8    fn health_report_from_catalog(
9        &self,
10        catalog: &crate::catalog::CatalogModelSnapshot,
11    ) -> crate::health::HealthReport {
12        self.health_from_catalog(catalog)
13    }
14
15    fn readiness_from_health(
16        &self,
17        report: &crate::health::HealthReport,
18    ) -> crate::application::native::RuntimeReadiness {
19        let database = self.db();
20        let (query, write, repair) = database.readiness_flags_from_health(report);
21        let (query_serverless, write_serverless, repair_serverless) =
22            database.readiness_flags_from_health_serverless(report);
23        crate::application::native::RuntimeReadiness {
24            query,
25            query_serverless,
26            write,
27            write_serverless,
28            repair,
29            repair_serverless,
30        }
31    }
32
33    fn collection_roots(&self) -> RedDBResult<BTreeMap<String, u64>> {
34        RedDBRuntime::collection_roots(self)
35    }
36
37    fn snapshots(&self) -> RedDBResult<Vec<SnapshotDescriptor>> {
38        RedDBRuntime::snapshots(self)
39    }
40
41    fn exports(&self) -> RedDBResult<Vec<ExportDescriptor>> {
42        RedDBRuntime::exports(self)
43    }
44
45    fn physical_metadata(&self) -> RedDBResult<PhysicalMetadataFile> {
46        self.db()
47            .physical_metadata()
48            .ok_or_else(|| crate::RedDBError::NotFound("physical metadata".to_string()))
49    }
50
51    fn manifest_events_filtered(
52        &self,
53        collection: Option<&str>,
54        kind: Option<&str>,
55        since_snapshot: Option<u64>,
56    ) -> RedDBResult<Vec<ManifestEvent>> {
57        RedDBRuntime::manifest_events_filtered(self, collection, kind, since_snapshot)
58    }
59
60    fn create_snapshot(&self) -> RedDBResult<SnapshotDescriptor> {
61        RedDBRuntime::create_snapshot(self)
62    }
63
64    fn create_export(&self, name: String) -> RedDBResult<ExportDescriptor> {
65        RedDBRuntime::create_export(self, name)
66    }
67
68    fn checkpoint(&self) -> RedDBResult<()> {
69        RedDBRuntime::checkpoint(self)
70    }
71
72    fn apply_retention_policy(&self) -> RedDBResult<()> {
73        RedDBRuntime::apply_retention_policy(self)
74    }
75
76    fn run_maintenance(&self) -> RedDBResult<()> {
77        RedDBRuntime::run_maintenance(self)
78    }
79
80    fn native_header(&self) -> RedDBResult<PhysicalFileHeader> {
81        RedDBRuntime::native_header(self)
82    }
83
84    fn native_collection_roots(&self) -> RedDBResult<BTreeMap<String, u64>> {
85        RedDBRuntime::native_collection_roots(self)
86    }
87
88    fn native_manifest_summary(&self) -> RedDBResult<NativeManifestSummary> {
89        RedDBRuntime::native_manifest_summary(self)
90    }
91
92    fn native_registry_summary(&self) -> RedDBResult<NativeRegistrySummary> {
93        RedDBRuntime::native_registry_summary(self)
94    }
95
96    fn native_recovery_summary(&self) -> RedDBResult<NativeRecoverySummary> {
97        RedDBRuntime::native_recovery_summary(self)
98    }
99
100    fn native_catalog_summary(&self) -> RedDBResult<NativeCatalogSummary> {
101        RedDBRuntime::native_catalog_summary(self)
102    }
103
104    fn native_physical_state(&self) -> RedDBResult<NativePhysicalState> {
105        RedDBRuntime::native_physical_state(self)
106    }
107
108    fn native_vector_artifact_pages(&self) -> RedDBResult<Vec<NativeVectorArtifactPageSummary>> {
109        RedDBRuntime::native_vector_artifact_pages(self)
110    }
111
112    fn inspect_native_vector_artifact(
113        &self,
114        collection: &str,
115        artifact_kind: Option<&str>,
116    ) -> RedDBResult<NativeVectorArtifactInspection> {
117        RedDBRuntime::inspect_native_vector_artifact(self, collection, artifact_kind)
118    }
119
120    fn warmup_native_vector_artifact(
121        &self,
122        collection: &str,
123        artifact_kind: Option<&str>,
124    ) -> RedDBResult<NativeVectorArtifactInspection> {
125        RedDBRuntime::warmup_native_vector_artifact(self, collection, artifact_kind)
126    }
127
128    fn inspect_native_vector_artifacts(&self) -> RedDBResult<NativeVectorArtifactBatchInspection> {
129        RedDBRuntime::inspect_native_vector_artifacts(self)
130    }
131
132    fn warmup_native_vector_artifacts(&self) -> RedDBResult<NativeVectorArtifactBatchInspection> {
133        RedDBRuntime::warmup_native_vector_artifacts(self)
134    }
135
136    fn native_header_repair_policy(&self) -> RedDBResult<String> {
137        RedDBRuntime::native_header_repair_policy(self)
138    }
139
140    fn repair_native_header_from_metadata(&self) -> RedDBResult<String> {
141        RedDBRuntime::repair_native_header_from_metadata(self)
142    }
143
144    fn rebuild_physical_metadata_from_native_state(&self) -> RedDBResult<bool> {
145        RedDBRuntime::rebuild_physical_metadata_from_native_state(self)
146    }
147
148    fn repair_native_physical_state_from_metadata(&self) -> RedDBResult<bool> {
149        RedDBRuntime::repair_native_physical_state_from_metadata(self)
150    }
151
152    fn native_metadata_state_summary(&self) -> RedDBResult<NativeMetadataStateSummary> {
153        RedDBRuntime::native_metadata_state_summary(self)
154    }
155
156    fn physical_authority_status(&self) -> PhysicalAuthorityStatus {
157        RedDBRuntime::physical_authority_status(self)
158    }
159
160    fn validate_current_serverless_generation(&self) -> RedDBResult<()> {
161        RedDBRuntime::read_current_serverless_generation_verified(self).map(|_| ())
162    }
163
164    fn readiness_for_query(&self) -> bool {
165        RedDBRuntime::readiness_for_query(self)
166    }
167
168    fn readiness_for_query_serverless(&self) -> bool {
169        RedDBRuntime::readiness_for_query_serverless(self)
170    }
171
172    fn readiness_for_write(&self) -> bool {
173        RedDBRuntime::readiness_for_write(self)
174    }
175
176    fn readiness_for_write_serverless(&self) -> bool {
177        RedDBRuntime::readiness_for_write_serverless(self)
178    }
179
180    fn readiness_for_repair(&self) -> bool {
181        RedDBRuntime::readiness_for_repair(self)
182    }
183
184    fn readiness_for_repair_serverless(&self) -> bool {
185        RedDBRuntime::readiness_for_repair_serverless(self)
186    }
187}