File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed
Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: PMPL-1.0-or-later
2+ // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+ //
4+ // VeriSimDB V-lang API — Cross-modal entity consistency engine client.
5+ module verisimdb
6+
7+ pub enum OctadField {
8+ name
9+ description
10+ provenance
11+ temporal
12+ spatial
13+ relational
14+ categorical
15+ metric
16+ }
17+
18+ pub struct Octad {
19+ pub :
20+ id string
21+ fields map [string ]string
22+ version int
23+ created_at i64
24+ modified_at i64
25+ }
26+
27+ pub struct DriftReport {
28+ pub :
29+ entity_id string
30+ field OctadField
31+ old_value string
32+ new_value string
33+ drift_score f64 // 0.0 = identical, 1.0 = completely changed
34+ }
35+
36+ fn C.verisimdb_store_octad (id_ptr & u8 , data_ptr & u8 , data_len int ) int
37+ fn C.verisimdb_get_octad (id_ptr & u8 , out_ptr && u8 , out_len & int ) int
38+ fn C.verisimdb_detect_drift (id_ptr & u8 ) int
39+ fn C.verisimdb_clamp_drift_score (score f64 ) f64
40+
41+ // store saves an octad to VeriSimDB.
42+ pub fn store (id string , data []u8 ) ! int {
43+ result := C.verisimdb_store_octad (id.str, data.data, data.len)
44+ if result != 0 {
45+ return error ('store failed: ${result} ' )
46+ }
47+ return result
48+ }
49+
50+ // detect_drift checks for entity drift on a given ID.
51+ pub fn detect_drift (id string ) bool {
52+ return C.verisimdb_detect_drift (id.str) == 1
53+ }
54+
55+ // clamp_drift_score ensures drift is within [0.0, 1.0].
56+ pub fn clamp_drift_score (score f64 ) f64 {
57+ return C.verisimdb_clamp_drift_score (score)
58+ }
You can’t perform that action at this time.
0 commit comments