hawdb 0.17.0

An embedded Rust graph database for local data-plane workloads
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
// Copyright 2026 Nowledge
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Compatibility module paths for contracts owned by internal crates.
//!
//! The embedded `hawdb` facade keeps these paths stable while the behavior,
//! types, and serialization contracts remain owned by their dedicated crates.

/// Compatibility facade for storage-neutral, redacted diagnostic evidence.
pub mod blackbox {
    pub use hawdb_evidence::blackbox::*;

    #[cfg(test)]
    mod tests {
        use super::*;

        #[test]
        fn blackbox_facade_preserves_public_function_and_type_identity() {
            type Report = fn(&crate::BlackboxReportOptions) -> crate::Result<crate::BlackboxReport>;
            type JsonReport = fn(&crate::BlackboxReportOptions) -> crate::Result<serde_json::Value>;
            let _: [Report; 4] = [
                crate::blackbox_report,
                blackbox_report,
                hawdb_evidence::blackbox::blackbox_report,
                crate::write_blackbox_report_typed,
            ];
            let _: [JsonReport; 4] = [
                crate::blackbox_report_json,
                blackbox_report_json,
                crate::write_blackbox_report,
                hawdb_evidence::blackbox::write_blackbox_report,
            ];
            let status: hawdb_evidence::blackbox::BlackboxRunStatus =
                crate::BlackboxRunStatus::Failed;
            assert_eq!(status, BlackboxRunStatus::Failed);
            assert_eq!(crate::BLACKBOX_REPORT_PROTOCOL, "hawdb-blackbox-report-v1");
            assert_eq!(crate::BLACKBOX_EVENT_PROTOCOL, "hawdb-blackbox-event-v1");
            for value in [
                serde_json::Value::Null,
                serde_json::json!({}),
                serde_json::json!([]),
            ] {
                let readiness: crate::BlackboxReadinessReport =
                    blackbox_readiness_from_manifest_json(&value);
                assert!(!readiness.ready);
                assert_eq!(
                    readiness,
                    hawdb_evidence::blackbox::blackbox_readiness_from_manifest_json(&value),
                );
                assert_eq!(
                    readiness,
                    crate::blackbox_readiness_from_manifest_json(&value)
                );
            }
        }
    }
}

/// Compatibility re-exports for evidence-owned background-maintenance preflight.
pub mod background_maintenance_evidence {
    pub use hawdb_evidence::background_maintenance_evidence::*;

    #[cfg(test)]
    mod tests {
        use super::nowledge_background_maintenance_evidence_json;

        #[test]
        fn root_compatibility_module_preserves_evidence_entrypoint() {
            let facade: fn(&serde_json::Value, bool) -> serde_json::Value =
                nowledge_background_maintenance_evidence_json;
            assert!(std::ptr::fn_addr_eq(
                facade,
                hawdb_evidence::background_maintenance_evidence::nowledge_background_maintenance_evidence_json
                    as fn(_, _) -> _,
            ));
        }
    }
}

/// Compatibility re-exports for the bounded-read evidence CLI adapter.
pub mod bounded_read_evidence {
    pub use hawdb_readiness::bounded_read_evidence_cli::*;

    #[cfg(test)]
    mod tests {
        use super::{parse_graph_route_readiness_json, parse_read_report_json};
        use crate::{NowledgeMemReadReport, NowledgeMemRouteReadinessSummary, Result};

        #[test]
        fn bounded_read_evidence_facade_preserves_contract_types() {
            let _: fn(&serde_json::Value) -> Result<NowledgeMemReadReport> = parse_read_report_json;
            let _: fn(&serde_json::Value) -> Result<NowledgeMemRouteReadinessSummary> =
                parse_graph_route_readiness_json;
        }
    }
}

/// Compatibility facade for `hawdb-cypher`.
pub mod cypher {
    pub use hawdb_cypher::*;
}

/// Compatibility re-exports for readiness-owned graph route CLI adapters.
pub mod graph_route_readiness {
    pub use hawdb_readiness::graph_route_cli::*;

    #[cfg(test)]
    mod tests {
        use super::nowledge_graph_route_readiness_json;

        #[test]
        fn root_compatibility_module_preserves_graph_route_readiness_entrypoint() {
            let facade: fn(&serde_json::Value) -> hawdb_core::Result<serde_json::Value> =
                nowledge_graph_route_readiness_json;
            assert!(std::ptr::fn_addr_eq(
                facade,
                hawdb_readiness::graph_route::nowledge_graph_route_readiness_json as fn(_) -> _,
            ));
        }
    }
}

/// Compatibility re-exports for readiness-owned integration bundle CLI adapters.
pub mod mem_integration_bundle {
    pub use hawdb_readiness::integration_bundle_cli::*;

    #[cfg(test)]
    mod tests {
        use hawdb_readiness::integration_bundle_cli;
        use std::any::TypeId;

        #[test]
        fn facade_preserves_owner_type_and_function_identity() {
            assert_eq!(
                TypeId::of::<crate::IntegrationBundleInputs>(),
                TypeId::of::<integration_bundle_cli::IntegrationBundleInputs>()
            );
            let bundle: fn(
                integration_bundle_cli::IntegrationBundleInputs,
            ) -> crate::Result<serde_json::Value> = crate::nowledge_mem_integration_bundle_json;
            assert!(std::ptr::fn_addr_eq(
                bundle,
                integration_bundle_cli::nowledge_mem_integration_bundle_json as fn(_) -> _,
            ));
            let runner: fn(std::vec::IntoIter<String>) -> crate::Result<(serde_json::Value, bool)> =
                crate::mem_integration_bundle::run_nowledge_mem_integration_bundle;
            assert!(std::ptr::fn_addr_eq(
                runner,
                integration_bundle_cli::run_nowledge_mem_integration_bundle
                    as fn(std::vec::IntoIter<String>) -> crate::Result<(serde_json::Value, bool)>,
            ));

            use hawdb_readiness::graph_summary;
            assert_eq!(
                TypeId::of::<crate::GraphRouteReadinessSummary>(),
                TypeId::of::<graph_summary::GraphRouteReadinessSummary>()
            );
            let summary: fn(&serde_json::Value) -> graph_summary::GraphRouteReadinessSummary =
                crate::nowledge_graph_route_readiness_summary;
            assert!(std::ptr::fn_addr_eq(
                summary,
                graph_summary::nowledge_graph_route_readiness_summary as fn(_) -> _,
            ));
            let from_bundle: fn(&serde_json::Value) -> graph_summary::GraphRouteReadinessSummary =
                crate::nowledge_graph_route_readiness_summary_from_bundle;
            assert!(std::ptr::fn_addr_eq(
                from_bundle,
                graph_summary::nowledge_graph_route_readiness_summary_from_bundle as fn(_) -> _,
            ));
        }
    }
}

/// Compatibility re-exports for readiness-owned integration cutover evaluation.
pub mod mem_integration_readiness {
    pub use hawdb_readiness::integration_readiness::*;

    #[cfg(test)]
    mod tests {
        use super::nowledge_mem_integration_readiness_json;

        #[test]
        fn root_compatibility_module_preserves_integration_entrypoint() {
            let facade: fn(&serde_json::Value) -> serde_json::Value =
                nowledge_mem_integration_readiness_json;
            assert!(std::ptr::fn_addr_eq(
                facade,
                hawdb_readiness::integration_readiness::nowledge_mem_integration_readiness_json
                    as fn(_) -> _,
            ));
        }
    }
}

/// Compatibility facade for `hawdb-optimizer`.
pub mod optimizer {
    pub use hawdb_optimizer::*;
    pub use hawdb_plan_cypher::{PhysicalOperatorDomain, PhysicalPlan, PhysicalPlanChildren};
}

/// Compatibility facade for `hawdb-plan-cypher`.
pub mod planner {
    pub use hawdb_plan_cypher::*;
}

/// Compatibility re-exports for the readiness-owned previous-wrapper preflight.
pub mod previous_wrapper_preflight {
    pub use hawdb_readiness::previous_wrapper_preflight::*;

    #[cfg(test)]
    mod tests {
        use super::{
            nowledge_previous_wrapper_preflight_check_usage,
            run_nowledge_previous_wrapper_preflight_check,
            NOWLEDGE_PREVIOUS_WRAPPER_PREFLIGHT_PROTOCOL,
        };

        #[test]
        fn root_compatibility_module_preserves_preflight_entrypoint() {
            let error = run_nowledge_previous_wrapper_preflight_check(std::iter::empty())
                .expect_err("missing inputs must retain the public usage error");
            assert_eq!(
                error.to_string(),
                format!(
                    "semantic error: {}",
                    nowledge_previous_wrapper_preflight_check_usage()
                )
            );
            assert_eq!(
                NOWLEDGE_PREVIOUS_WRAPPER_PREFLIGHT_PROTOCOL,
                hawdb_readiness::previous_wrapper_preflight::NOWLEDGE_PREVIOUS_WRAPPER_PREFLIGHT_PROTOCOL,
            );
        }
    }
}

/// Compatibility facade for `hawdb-qos`.
pub mod qos {
    pub use hawdb_qos::*;
}

/// Compatibility re-exports for evidence-owned query-family preflight.
pub mod query_family_evidence {
    pub use hawdb_evidence::query_family_evidence::*;

    #[cfg(test)]
    mod tests {
        use super::nowledge_query_family_evidence_json;

        #[test]
        fn root_compatibility_module_preserves_evidence_entrypoint() {
            let facade: fn(&serde_json::Value) -> crate::Result<serde_json::Value> =
                nowledge_query_family_evidence_json;
            assert!(std::ptr::fn_addr_eq(
                facade,
                hawdb_evidence::query_family_evidence::nowledge_query_family_evidence_json
                    as fn(_) -> _,
            ));
        }
    }
}

/// Compatibility facade for graph route ownership and readiness contracts.
pub mod route_ownership {
    pub use hawdb_route_ownership::graph::{
        nowledge_mem_route_ownership_all_hawdb, nowledge_mem_route_ownership_all_legacy,
        nowledge_mem_route_ownership_for_engine, nowledge_mem_route_ownership_readiness,
        NowledgeMemRouteOwnership, NowledgeMemRouteOwnershipPolicy,
        NowledgeMemRouteOwnershipReadinessReport, NowledgeMemRouteReadEngine,
        NOWLEDGE_MEM_ROUTE_OWNERSHIP_PROTOCOL,
    };

    #[cfg(test)]
    mod facade_tests {
        use super::*;
        use hawdb_route_ownership::graph as owner;

        #[test]
        fn ownership_facade_preserves_concrete_types_and_function_signatures() {
            let summarize: fn(
                &[owner::NowledgeMemRouteOwnership],
                Option<&crate::NowledgeMemRouteReadinessSummary>,
                owner::NowledgeMemRouteOwnershipPolicy,
            ) -> crate::NowledgeMemRouteOwnershipReadinessReport =
                crate::nowledge_mem_route_ownership_readiness;
            let routes: Vec<owner::NowledgeMemRouteOwnership> =
                nowledge_mem_route_ownership_all_legacy();
            let report: NowledgeMemRouteOwnershipReadinessReport =
                summarize(&routes, None, NowledgeMemRouteOwnershipPolicy::migration());
            assert!(report.ready);
            assert!(!report.production_cutover_ready);
            assert_eq!(report.route_catalog_digest, "fnv1a64:80816a4f519d9693");
            assert_eq!(
                report,
                owner::nowledge_mem_route_ownership_readiness(
                    &routes,
                    None,
                    NowledgeMemRouteOwnershipPolicy::migration(),
                )
            );
        }

        #[test]
        fn catalog_facade_preserves_public_paths_and_concrete_types() {
            let lookup: fn(&str) -> Option<&'static owner::NowledgeMemGraphReadRouteSpec> =
                crate::nowledge_mem_graph_read_route_spec;
            let summary: Option<&owner::NowledgeMemRouteReadinessSummary> =
                None::<&crate::nowledge_mem::NowledgeMemRouteReadinessSummary>;
            assert!(summary.is_none());
            for expected in owner::NOWLEDGE_MEM_GRAPH_READ_ROUTE_SPECS {
                assert_eq!(lookup(expected.route).unwrap(), expected);
                let actual: &crate::NowledgeMemGraphReadRouteSpec =
                    crate::nowledge_mem::nowledge_mem_graph_read_route_spec(expected.route)
                        .unwrap();
                assert_eq!(actual, expected);
                let _: crate::NowledgeMemGraphReadRouteOwner = expected.owner;
                let _: crate::NowledgeMemGraphReadRouteEvidenceKind =
                    expected.required_evidence_kind;
            }
            assert_eq!(
                crate::nowledge_mem::NOWLEDGE_MEM_GRAPH_READ_ROUTE_SPECS,
                owner::NOWLEDGE_MEM_GRAPH_READ_ROUTE_SPECS
            );
            assert_eq!(
                crate::REQUIRED_NOWLEDGE_MEM_BOUNDED_READ_ROUTES,
                owner::REQUIRED_NOWLEDGE_MEM_BOUNDED_READ_ROUTES
            );
            assert_eq!(
                crate::nowledge_mem_graph_read_route_specs_json(),
                owner::nowledge_mem_graph_read_route_specs_json()
            );
            assert_eq!(
                crate::nowledge_mem_graph_read_route_catalog_digest(),
                "fnv1a64:80816a4f519d9693"
            );
        }
    }
}

/// Compatibility re-exports for search-owned candidate evidence CLI adapters.
pub mod search_candidate_shadow_evidence {
    pub use hawdb_search::candidate_evidence_cli::*;

    #[cfg(test)]
    mod tests {
        use super::parse_search_candidate_shadow_probe;

        #[test]
        fn root_compatibility_module_preserves_candidate_probe_entrypoint() {
            let facade: fn(
                &serde_json::Value,
            ) -> hawdb_core::Result<
                hawdb_search::candidate_evidence::NowledgeMemSearchCandidateShadowAccumulator,
            > = parse_search_candidate_shadow_probe;
            assert!(std::ptr::fn_addr_eq(
                facade,
                hawdb_search::candidate_evidence::parse_search_candidate_shadow_probe as fn(_) -> _,
            ));
        }
    }
}

/// Compatibility re-exports for search-owned projection evidence CLI adapters.
pub mod search_projection_evidence {
    pub use hawdb_search::projection_evidence_cli::*;

    #[cfg(test)]
    mod tests {
        use hawdb_search::projection_evidence_cli;
        use std::any::TypeId;

        #[test]
        fn facade_preserves_owner_type_and_function_identity() {
            assert_eq!(
                TypeId::of::<crate::NowledgeSearchProjectionEvidenceReport>(),
                TypeId::of::<projection_evidence_cli::NowledgeSearchProjectionEvidenceReport>()
            );
            let evidence: fn(&serde_json::Value) -> serde_json::Value =
                crate::search_projection_evidence::nowledge_search_projection_evidence_json;
            assert!(std::ptr::fn_addr_eq(
                evidence,
                projection_evidence_cli::nowledge_search_projection_evidence_json as fn(_) -> _,
            ));
            let runner: fn(std::vec::IntoIter<String>) -> crate::Result<(serde_json::Value, bool)> =
                crate::search_projection_evidence::run_nowledge_search_projection_evidence;
            assert!(std::ptr::fn_addr_eq(
                runner,
                projection_evidence_cli::run_nowledge_search_projection_evidence
                    as fn(std::vec::IntoIter<String>) -> crate::Result<(serde_json::Value, bool)>,
            ));
        }
    }
}

/// Compatibility re-exports for evidence-owned storage-recovery preflight.
pub mod storage_recovery_evidence {
    pub use hawdb_evidence::storage_recovery_evidence::*;

    #[cfg(test)]
    mod tests {
        use super::nowledge_storage_recovery_evidence_json;

        #[test]
        fn root_compatibility_module_preserves_evidence_entrypoint() {
            let facade: fn(&serde_json::Value, bool) -> serde_json::Value =
                nowledge_storage_recovery_evidence_json;
            assert!(std::ptr::fn_addr_eq(
                facade,
                hawdb_evidence::storage_recovery_evidence::nowledge_storage_recovery_evidence_json
                    as fn(_, _) -> _,
            ));
        }
    }
}