@nowledge/hawdb-ffi-linux-arm64-gnu 0.0.0-stage → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +6 -2
- package/hawdb_ffi.h +897 -0
- package/libhawdb_ffi.so +0 -0
- package/package.json +28 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nowledge/hawdb-ffi-linux-arm64-gnu
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The HawDB 0.34.0 C ABI shared library (`libhawdb_ffi.so`) and its
|
|
4
|
+
header for `aarch64-unknown-linux-gnu`. Install `@nowledge/hawdb-bun` instead of
|
|
5
|
+
depending on this package directly; it selects the matching platform package.
|
|
6
|
+
|
|
7
|
+
See https://github.com/nowledge-co/hawdb/blob/main/docs/PREBUILT_LIBRARIES.md.
|
package/hawdb_ffi.h
ADDED
|
@@ -0,0 +1,897 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Nowledge
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/* Generated by cbindgen. Do not edit by hand. */
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
#pragma once
|
|
21
|
+
|
|
22
|
+
#include <stdarg.h>
|
|
23
|
+
#include <stdbool.h>
|
|
24
|
+
#include <stdint.h>
|
|
25
|
+
#include <stdlib.h>
|
|
26
|
+
|
|
27
|
+
#define HAWDB_RETAINED_ABI_V1 1
|
|
28
|
+
|
|
29
|
+
#define HAWDB_RETAINED_OK 0
|
|
30
|
+
|
|
31
|
+
#define HAWDB_RETAINED_EOF 1
|
|
32
|
+
|
|
33
|
+
#define HAWDB_RETAINED_BACKPRESSURE 2
|
|
34
|
+
|
|
35
|
+
#define HAWDB_RETAINED_INVALID_HANDLE 3
|
|
36
|
+
|
|
37
|
+
#define HAWDB_RETAINED_INVALID_ARGUMENT 4
|
|
38
|
+
|
|
39
|
+
#define HAWDB_RETAINED_PANIC 5
|
|
40
|
+
|
|
41
|
+
#define HAWDB_RETAINED_CLOSED 6
|
|
42
|
+
|
|
43
|
+
#define HAWDB_RETAINED_WORKING_UNIT_TOO_LARGE 7
|
|
44
|
+
|
|
45
|
+
#define HAWDB_RETAINED_EXECUTION_ERROR 8
|
|
46
|
+
|
|
47
|
+
#define HAWDB_RETAINED_RESULT_BUDGET 9
|
|
48
|
+
|
|
49
|
+
#define HAWDB_RETAINED_UNSUPPORTED_PLAN 10
|
|
50
|
+
|
|
51
|
+
#define HAWDB_RETAINED_UNSUPPORTED_LAYOUT 11
|
|
52
|
+
|
|
53
|
+
#define HAWDB_RETAINED_UNSUPPORTED_TYPE 12
|
|
54
|
+
|
|
55
|
+
#define HAWDB_RETAINED_COPY_REQUIRED 13
|
|
56
|
+
|
|
57
|
+
#define HAWDB_RETAINED_SELECTION_REQUIRES_MATERIALIZATION 14
|
|
58
|
+
|
|
59
|
+
#define HAWDB_RETAINED_INVALID_COLUMN 15
|
|
60
|
+
|
|
61
|
+
#define HAWDB_RETAINED_SIZE_OVERFLOW 16
|
|
62
|
+
|
|
63
|
+
#define HAWDB_RETAINED_STOPPED 17
|
|
64
|
+
|
|
65
|
+
#define HAWDB_RETAINED_ADMISSION_ERROR 18
|
|
66
|
+
|
|
67
|
+
#define HAWDB_RETAINED_INT64 1
|
|
68
|
+
|
|
69
|
+
#define HAWDB_RETAINED_FLOAT64 2
|
|
70
|
+
|
|
71
|
+
#define HAWDB_RETAINED_UINT64 3
|
|
72
|
+
|
|
73
|
+
#define HAWDB_RETAINED_PROPERTY 1
|
|
74
|
+
|
|
75
|
+
#define HAWDB_RETAINED_NODE_IDENTITY 2
|
|
76
|
+
|
|
77
|
+
#define HAWDB_RETAINED_READ_ONLY 1
|
|
78
|
+
|
|
79
|
+
#define HAWDB_RETAINED_BORROWED 2
|
|
80
|
+
|
|
81
|
+
#define HAWDB_RETAINED_REQUIRE_SOURCE_REUSE 1
|
|
82
|
+
|
|
83
|
+
#define HAWDB_RETAINED_REQUEST_WRITABLE 2
|
|
84
|
+
|
|
85
|
+
#define HAWDB_RETAINED_VALIDITY_ALL 1
|
|
86
|
+
|
|
87
|
+
#define HAWDB_RETAINED_VALIDITY_U64_LSB 2
|
|
88
|
+
|
|
89
|
+
#define HAWDB_RETAINED_NODE 1
|
|
90
|
+
|
|
91
|
+
#define HAWDB_RETAINED_NULL 2
|
|
92
|
+
|
|
93
|
+
#define HAWDB_RETAINED_BOOL 3
|
|
94
|
+
|
|
95
|
+
#define HAWDB_RETAINED_NODE_INT64 4
|
|
96
|
+
|
|
97
|
+
#define HAWDB_RETAINED_NODE_FLOAT64 5
|
|
98
|
+
|
|
99
|
+
#define HAWDB_RETAINED_UTF8 6
|
|
100
|
+
|
|
101
|
+
#define HAWDB_RETAINED_BINARY 7
|
|
102
|
+
|
|
103
|
+
#define HAWDB_RETAINED_UUID 8
|
|
104
|
+
|
|
105
|
+
#define HAWDB_RETAINED_LIST 9
|
|
106
|
+
|
|
107
|
+
#define HAWDB_RETAINED_MAP 10
|
|
108
|
+
|
|
109
|
+
#define HAWDB_RETAINED_VECTOR 11
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* An open HawDB database handle. Opaque to C callers.
|
|
113
|
+
*/
|
|
114
|
+
typedef struct HawdbDatabase HawdbDatabase;
|
|
115
|
+
|
|
116
|
+
#if defined(HAWDB_BOUNDARY_PROFILING)
|
|
117
|
+
typedef struct BoundaryProfileSnapshot {
|
|
118
|
+
uint64_t allocation_calls;
|
|
119
|
+
uint64_t allocated_bytes;
|
|
120
|
+
uint64_t deallocation_calls;
|
|
121
|
+
uint64_t deallocated_bytes;
|
|
122
|
+
uint64_t reallocation_calls;
|
|
123
|
+
uint64_t live_requested_bytes;
|
|
124
|
+
uint64_t process_peak_requested_bytes;
|
|
125
|
+
uint64_t parameter_conversion_ns;
|
|
126
|
+
uint64_t engine_call_ns;
|
|
127
|
+
uint64_t result_conversion_ns;
|
|
128
|
+
} BoundaryProfileSnapshot;
|
|
129
|
+
#endif
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* A byte buffer the library hands to the caller.
|
|
133
|
+
*
|
|
134
|
+
* `ptr` is `len` bytes of UTF-8 text; it is NUL-terminated as a courtesy
|
|
135
|
+
* but `len` is authoritative and the content may not contain NUL bytes
|
|
136
|
+
* anyway (JSON escapes them). The caller owns every non-NULL `ptr` and
|
|
137
|
+
* releases it with [`hawdb_buffer_free`]. The library never retains or
|
|
138
|
+
* reuses a buffer it has returned.
|
|
139
|
+
*/
|
|
140
|
+
typedef struct HawdbBuffer {
|
|
141
|
+
char *ptr;
|
|
142
|
+
uintptr_t len;
|
|
143
|
+
} HawdbBuffer;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* All lengths are byte lengths. A zero batch/slot limit selects the Rust
|
|
147
|
+
* default. Unknown flags/versions refuse before ownership transfer.
|
|
148
|
+
*/
|
|
149
|
+
typedef struct HawdbRetainedQueryV1 {
|
|
150
|
+
uint32_t abi_version;
|
|
151
|
+
uint32_t struct_size;
|
|
152
|
+
const char *cypher;
|
|
153
|
+
uint64_t cypher_len;
|
|
154
|
+
const char *params_json;
|
|
155
|
+
uint64_t params_len;
|
|
156
|
+
uint32_t batch_rows;
|
|
157
|
+
uint32_t outstanding_batches;
|
|
158
|
+
uint64_t batch_bytes;
|
|
159
|
+
uint32_t flags;
|
|
160
|
+
uint32_t reserved;
|
|
161
|
+
} HawdbRetainedQueryV1;
|
|
162
|
+
|
|
163
|
+
typedef struct HawdbRetainedCursorV1 {
|
|
164
|
+
uint32_t abi_version;
|
|
165
|
+
uint32_t struct_size;
|
|
166
|
+
uint64_t owner_namespace;
|
|
167
|
+
uint64_t owner_id;
|
|
168
|
+
uint64_t column_count;
|
|
169
|
+
} HawdbRetainedCursorV1;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Borrowed immutable range. data addresses the visible range; byte_offset is
|
|
173
|
+
* allocation provenance and must not be applied to data a second time. Keep
|
|
174
|
+
* the owner live and library mapped. A small slice retains its full capacity.
|
|
175
|
+
*/
|
|
176
|
+
typedef struct HawdbRetainedBufferV1 {
|
|
177
|
+
uint32_t abi_version;
|
|
178
|
+
uint32_t struct_size;
|
|
179
|
+
const void *data;
|
|
180
|
+
uint64_t allocation_namespace;
|
|
181
|
+
uint64_t allocation_id;
|
|
182
|
+
uint64_t generation;
|
|
183
|
+
uint64_t retained_capacity_bytes;
|
|
184
|
+
uint64_t byte_offset;
|
|
185
|
+
uint64_t byte_length;
|
|
186
|
+
} HawdbRetainedBufferV1;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Selected indices address the physical rows, without gathering their values.
|
|
190
|
+
* Release owner_id explicitly. EOF never carries a live batch owner.
|
|
191
|
+
*/
|
|
192
|
+
typedef struct HawdbRetainedBatchV1 {
|
|
193
|
+
uint32_t abi_version;
|
|
194
|
+
uint32_t struct_size;
|
|
195
|
+
uint64_t owner_namespace;
|
|
196
|
+
uint64_t owner_id;
|
|
197
|
+
uint64_t physical_rows;
|
|
198
|
+
uint64_t selected_rows;
|
|
199
|
+
uint64_t column_count;
|
|
200
|
+
struct HawdbRetainedBufferV1 selection;
|
|
201
|
+
} HawdbRetainedBatchV1;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Schema names borrow the supplied cursor/batch/column handle. They are UTF-8
|
|
205
|
+
* byte ranges, without a NUL-termination contract.
|
|
206
|
+
*/
|
|
207
|
+
typedef struct HawdbRetainedSchemaV1 {
|
|
208
|
+
uint32_t abi_version;
|
|
209
|
+
uint32_t struct_size;
|
|
210
|
+
const char *name;
|
|
211
|
+
uint64_t name_len;
|
|
212
|
+
uint32_t data_type;
|
|
213
|
+
uint32_t role;
|
|
214
|
+
uint32_t nullable;
|
|
215
|
+
uint32_t flags;
|
|
216
|
+
} HawdbRetainedSchemaV1;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Independently owned read-only column, including its selection and validity.
|
|
220
|
+
* The validity bitmap consists of native u64 words; row r uses bit r % 64.
|
|
221
|
+
* Release this owner even when its parent batch was already released.
|
|
222
|
+
*/
|
|
223
|
+
typedef struct HawdbRetainedColumnV1 {
|
|
224
|
+
uint32_t abi_version;
|
|
225
|
+
uint32_t struct_size;
|
|
226
|
+
uint64_t owner_namespace;
|
|
227
|
+
uint64_t owner_id;
|
|
228
|
+
uint64_t physical_rows;
|
|
229
|
+
uint64_t selected_rows;
|
|
230
|
+
struct HawdbRetainedSchemaV1 schema;
|
|
231
|
+
struct HawdbRetainedBufferV1 values;
|
|
232
|
+
struct HawdbRetainedBufferV1 selection;
|
|
233
|
+
struct HawdbRetainedBufferV1 validity;
|
|
234
|
+
uint32_t validity_kind;
|
|
235
|
+
uint32_t flags;
|
|
236
|
+
} HawdbRetainedColumnV1;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Status is 0 Open, 1 Completed, 2 Failed or 3 Closed. Earlier views remain
|
|
240
|
+
* readable after failure/close; only Completed makes the result final.
|
|
241
|
+
*/
|
|
242
|
+
typedef struct HawdbRetainedStateV1 {
|
|
243
|
+
uint32_t abi_version;
|
|
244
|
+
uint32_t struct_size;
|
|
245
|
+
uint32_t status;
|
|
246
|
+
uint32_t terminal_code;
|
|
247
|
+
uint64_t visited_rows;
|
|
248
|
+
uint64_t emitted_rows;
|
|
249
|
+
uint64_t source_constructed_bytes;
|
|
250
|
+
uint64_t source_pinned_rows;
|
|
251
|
+
uint64_t source_pinned_pages;
|
|
252
|
+
} HawdbRetainedStateV1;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* All pointers borrow this independently releasable owner. Scalars are original
|
|
256
|
+
* native-endian storage, not descriptor copies. Names are UTF-8, not NUL-ended.
|
|
257
|
+
* Containers and NULL have no data buffer. These are row views, not Arrow arrays.
|
|
258
|
+
*/
|
|
259
|
+
typedef struct HawdbRetainedNodeV1 {
|
|
260
|
+
uint32_t abi_version;
|
|
261
|
+
uint32_t struct_size;
|
|
262
|
+
uint64_t owner_namespace;
|
|
263
|
+
uint64_t owner_id;
|
|
264
|
+
uint32_t kind;
|
|
265
|
+
uint32_t flags;
|
|
266
|
+
uint64_t child_count;
|
|
267
|
+
const void *data;
|
|
268
|
+
uint64_t byte_length;
|
|
269
|
+
const char *name;
|
|
270
|
+
uint64_t name_len;
|
|
271
|
+
} HawdbRetainedNodeV1;
|
|
272
|
+
|
|
273
|
+
#if defined(HAWDB_BOUNDARY_PROFILING)
|
|
274
|
+
/**
|
|
275
|
+
* Developer profiling build only. This observation is not an admission ledger
|
|
276
|
+
* or an allocator-capacity bound. NULL output is a no-op; no buffer is allocated.
|
|
277
|
+
*
|
|
278
|
+
* # Safety
|
|
279
|
+
* `out` must be NULL or point to writable `BoundaryProfileSnapshot` storage.
|
|
280
|
+
*/
|
|
281
|
+
void hawdb_boundary_profile_snapshot(struct BoundaryProfileSnapshot *out);
|
|
282
|
+
#endif
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Open a HawDB database at `path`, creating it if needed.
|
|
286
|
+
*
|
|
287
|
+
* `path` is `path_len` UTF-8 bytes and must not be NULL. `options_json`
|
|
288
|
+
* may be NULL or a JSON object. Every key is optional and names the typed
|
|
289
|
+
* Rust configuration field it sets; an absent key keeps the embedded
|
|
290
|
+
* default. Unknown keys and ill-typed values fail with `invalid_argument`.
|
|
291
|
+
*
|
|
292
|
+
* - `"read_only": bool` (default false). A read-only open uses strict
|
|
293
|
+
* recovery and never repairs a torn WAL tail.
|
|
294
|
+
* - `"durability": "sync_on_every_write" | "sync_on_checkpoint"` (default
|
|
295
|
+
* `"sync_on_every_write"`, power-loss safe). `"sync_on_checkpoint"`
|
|
296
|
+
* flushes each committed transaction's WAL to the OS before acknowledging
|
|
297
|
+
* it but synchronizes storage only at checkpoint boundaries, so a power
|
|
298
|
+
* failure may lose recently acknowledged transactions (never part of one).
|
|
299
|
+
* Branch creation, deletion and head publication stay power-loss safe.
|
|
300
|
+
* - `"max_read_result_rows": integer >= 0 | null` (default null). Host-wide
|
|
301
|
+
* read row ceiling; 0 and null mean no row ceiling.
|
|
302
|
+
* - `"max_read_intermediate_rows": integer >= 0 | null` (default null).
|
|
303
|
+
* Host-wide ceiling on the rows one relational SQL statement may scan,
|
|
304
|
+
* join or aggregate, independent of the rows it returns. null inherits
|
|
305
|
+
* `max_read_result_rows`; 0 means no intermediate row ceiling.
|
|
306
|
+
* - `"max_read_result_payload_bytes": integer > 0` (default 67108864).
|
|
307
|
+
* Host-wide read result payload budget; it can be tuned but not removed.
|
|
308
|
+
* - `"relational_monotonic_append_fast_path": bool` (default false). Opt-in
|
|
309
|
+
* metadata-only INSERT path for RowPage tables whose primary keys arrive
|
|
310
|
+
* in increasing order; other inserts fall back to the ordinary path.
|
|
311
|
+
*
|
|
312
|
+
* A read that exceeds a budget fails (`read_budget_exceeded`, or
|
|
313
|
+
* `resource_budget_exceeded` with a `resource_budget` object) rather than
|
|
314
|
+
* returning a partial result. Calls on one handle are serialized, so the
|
|
315
|
+
* handle has no group commit to configure.
|
|
316
|
+
*
|
|
317
|
+
* Returns a handle to pass to the other functions, or NULL on failure
|
|
318
|
+
* with `err_out` filled. Close the handle with [`hawdb_close`].
|
|
319
|
+
*
|
|
320
|
+
* # Safety
|
|
321
|
+
* `path` and `options_json` must be readable for `path_len` /
|
|
322
|
+
* `options_len` bytes or NULL; `err_out` must be NULL or writable
|
|
323
|
+
* [`HawdbBuffer`] storage. The returned handle is safe to use from
|
|
324
|
+
* multiple threads; calls are serialized internally.
|
|
325
|
+
*/
|
|
326
|
+
struct HawdbDatabase *hawdb_open(const char *path,
|
|
327
|
+
uintptr_t path_len,
|
|
328
|
+
const char *options_json,
|
|
329
|
+
uintptr_t options_len,
|
|
330
|
+
struct HawdbBuffer *err_out);
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Open an independent in-memory database using the embedded facade defaults.
|
|
334
|
+
* Close the returned handle with [`hawdb_close`]. Errors use the same output
|
|
335
|
+
* convention as [`hawdb_open`]; this does not create a temporary on-disk store.
|
|
336
|
+
*
|
|
337
|
+
* # Safety
|
|
338
|
+
* `err_out` must be NULL or point to writable [`HawdbBuffer`] storage.
|
|
339
|
+
*/
|
|
340
|
+
struct HawdbDatabase *hawdb_open_in_memory(struct HawdbBuffer *err_out);
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Close a database handle and release its resources.
|
|
344
|
+
*
|
|
345
|
+
* A transaction still open on the handle (see
|
|
346
|
+
* [`hawdb_begin_transaction`]) is rolled back: none of its statements are
|
|
347
|
+
* committed or visible after a reopen.
|
|
348
|
+
*
|
|
349
|
+
* # Safety
|
|
350
|
+
* `db` must be a handle returned by [`hawdb_open`] and not already
|
|
351
|
+
* closed. Passing NULL is a no-op.
|
|
352
|
+
*/
|
|
353
|
+
void hawdb_close(struct HawdbDatabase *db);
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Run one Cypher statement.
|
|
357
|
+
*
|
|
358
|
+
* `cypher` is `cypher_len` UTF-8 bytes and must not be NULL.
|
|
359
|
+
* `params_json` may be NULL or a JSON object mapping `$name` parameter
|
|
360
|
+
* names to values (`null`, bool, number, string, array, object, or the
|
|
361
|
+
* tagged forms `{"$binary": "<base64>"}` and `{"$uuid": "<text>"}`).
|
|
362
|
+
*
|
|
363
|
+
* On success returns true and `result_out` receives the result envelope
|
|
364
|
+
* `{"columns": [...], "rows": [[...], ...]}`; on failure returns false
|
|
365
|
+
* and `err_out` receives `{"kind", "message"}`.
|
|
366
|
+
*
|
|
367
|
+
* # Safety
|
|
368
|
+
* `db` must be a live [`hawdb_open`] handle; `cypher` and `params_json`
|
|
369
|
+
* must be readable for `cypher_len` / `params_len` bytes or NULL;
|
|
370
|
+
* `result_out` and `err_out` must be NULL or writable [`HawdbBuffer`]
|
|
371
|
+
* storage. A false return leaves the handle usable.
|
|
372
|
+
*/
|
|
373
|
+
bool hawdb_query(struct HawdbDatabase *db,
|
|
374
|
+
const char *cypher,
|
|
375
|
+
uintptr_t cypher_len,
|
|
376
|
+
const char *params_json,
|
|
377
|
+
uintptr_t params_len,
|
|
378
|
+
struct HawdbBuffer *result_out,
|
|
379
|
+
struct HawdbBuffer *err_out);
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Run one SQL statement.
|
|
383
|
+
*
|
|
384
|
+
* `params_json` may be NULL or a JSON array of positional `$1`
|
|
385
|
+
* parameters with the same value encoding as [`hawdb_query`]. Result
|
|
386
|
+
* and error conventions match [`hawdb_query`].
|
|
387
|
+
*
|
|
388
|
+
* # Safety
|
|
389
|
+
* Same contract as [`hawdb_query`].
|
|
390
|
+
*/
|
|
391
|
+
bool hawdb_query_sql(struct HawdbDatabase *db,
|
|
392
|
+
const char *sql,
|
|
393
|
+
uintptr_t sql_len,
|
|
394
|
+
const char *params_json,
|
|
395
|
+
uintptr_t params_len,
|
|
396
|
+
struct HawdbBuffer *result_out,
|
|
397
|
+
struct HawdbBuffer *err_out);
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Free a buffer returned by this library and zero the caller's
|
|
401
|
+
* [`HawdbBuffer`] so a second call is a safe no-op. Passing NULL for
|
|
402
|
+
* `buffer`, or a buffer whose `ptr` is NULL, is a no-op.
|
|
403
|
+
*
|
|
404
|
+
* # Safety
|
|
405
|
+
* `buffer` must be NULL or point to a [`HawdbBuffer`] whose `ptr` was
|
|
406
|
+
* allocated by this library and not already freed.
|
|
407
|
+
*/
|
|
408
|
+
void hawdb_buffer_free(struct HawdbBuffer *buffer);
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Copy the HawDB version string into `out`. The buffer is caller-owned
|
|
412
|
+
* like every other [`HawdbBuffer`]: release it with
|
|
413
|
+
* [`hawdb_buffer_free`].
|
|
414
|
+
*
|
|
415
|
+
* # Safety
|
|
416
|
+
* `out` must be NULL or point to writable [`HawdbBuffer`] storage.
|
|
417
|
+
*/
|
|
418
|
+
void hawdb_version(struct HawdbBuffer *out);
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* The engine-wide persistent format version of this library. Two library
|
|
422
|
+
* builds with the same value open each other's databases. Before replacing
|
|
423
|
+
* the library with one whose value differs, export each database with
|
|
424
|
+
* [`hawdb_export`] using the old library and import it with
|
|
425
|
+
* [`hawdb_import`] using the new one.
|
|
426
|
+
*/
|
|
427
|
+
uint32_t hawdb_format_version(void);
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* The newest logical dump format version this library writes and reads.
|
|
431
|
+
* [`hawdb_import`] accepts every dump version up to this one.
|
|
432
|
+
*/
|
|
433
|
+
uint32_t hawdb_dump_format_version(void);
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Export the handle's current snapshot as a logical dump directory at
|
|
437
|
+
* `dest_path` (`dest_len` UTF-8 bytes), which must not exist; its parent
|
|
438
|
+
* must. The dump is written beside the destination and moved onto it only
|
|
439
|
+
* when complete, with a move that never replaces an existing or
|
|
440
|
+
* concurrently created `dest_path`.
|
|
441
|
+
* The call holds the handle for its duration, so it reflects one consistent
|
|
442
|
+
* snapshot.
|
|
443
|
+
*
|
|
444
|
+
* On success returns true and `report_out` receives
|
|
445
|
+
* `{"dump_format_version", "persistent_format_version", "hawdb_version",
|
|
446
|
+
* "branch", "commit_epoch", "table_count", "table_row_count", "node_count",
|
|
447
|
+
* "relationship_count", "file_count", "total_bytes", "manifest_sha256"}`.
|
|
448
|
+
* On failure returns false and `err_out` receives `{"kind", "message"}`:
|
|
449
|
+
* `semantic` when the database holds a kind of data the dump format cannot
|
|
450
|
+
* represent yet, `transaction_open` while the handle has an open
|
|
451
|
+
* transaction, `invalid_argument` for a NULL or non-UTF-8 argument. Every
|
|
452
|
+
* kind except `publish_outcome_unknown` published nothing at `dest_path`.
|
|
453
|
+
* `publish_outcome_unknown` means the complete dump may already be at
|
|
454
|
+
* `dest_path` but its name is not yet known to be durable: keep it and
|
|
455
|
+
* reconcile with [`hawdb_confirm_dump_publication`] and
|
|
456
|
+
* [`hawdb_verify_dump`].
|
|
457
|
+
*
|
|
458
|
+
* # Safety
|
|
459
|
+
* `db` must be a live [`crate::hawdb_open`] handle or NULL; `dest_path` must
|
|
460
|
+
* be readable for `dest_len` bytes or NULL; `report_out` and `err_out` must
|
|
461
|
+
* be NULL or writable [`HawdbBuffer`] storage.
|
|
462
|
+
*/
|
|
463
|
+
bool hawdb_export(struct HawdbDatabase *db,
|
|
464
|
+
const char *dest_path,
|
|
465
|
+
uintptr_t dest_len,
|
|
466
|
+
struct HawdbBuffer *report_out,
|
|
467
|
+
struct HawdbBuffer *err_out);
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Build a new database at `dest_path` from the logical dump at `src_path`.
|
|
471
|
+
* `dest_path` must not exist; its parent must. The database is built in an
|
|
472
|
+
* unpublished directory beside the destination, every file is verified
|
|
473
|
+
* against the dump's SHA-256 and record counts, and the result is renamed
|
|
474
|
+
* onto `dest_path` only on complete success, never replacing an existing or
|
|
475
|
+
* concurrently created `dest_path`: a failed or interrupted import never
|
|
476
|
+
* leaves a database at `dest_path`. Needs no open handle; open the result
|
|
477
|
+
* with [`crate::hawdb_open`].
|
|
478
|
+
*
|
|
479
|
+
* On success returns true and `report_out` receives
|
|
480
|
+
* `{"dump_format_version", "source_hawdb_version",
|
|
481
|
+
* "source_persistent_format_version", "persistent_format_version",
|
|
482
|
+
* "table_count", "table_row_count", "node_count", "relationship_count",
|
|
483
|
+
* "file_count", "total_bytes", "manifest_sha256"}`. A dump written by a
|
|
484
|
+
* newer HawDB fails with `unsupported_storage_format`; a damaged or
|
|
485
|
+
* incomplete dump fails with `storage_integrity`. As for [`hawdb_export`],
|
|
486
|
+
* only `publish_outcome_unknown` may leave the complete database at
|
|
487
|
+
* `dest_path`: keep it, reconcile with [`hawdb_confirm_dump_publication`],
|
|
488
|
+
* then open it.
|
|
489
|
+
*
|
|
490
|
+
* # Safety
|
|
491
|
+
* `src_path` and `dest_path` must be readable for `src_len` / `dest_len`
|
|
492
|
+
* bytes or NULL; `report_out` and `err_out` must be NULL or writable
|
|
493
|
+
* [`HawdbBuffer`] storage.
|
|
494
|
+
*/
|
|
495
|
+
bool hawdb_import(const char *src_path,
|
|
496
|
+
uintptr_t src_len,
|
|
497
|
+
const char *dest_path,
|
|
498
|
+
uintptr_t dest_len,
|
|
499
|
+
struct HawdbBuffer *report_out,
|
|
500
|
+
struct HawdbBuffer *err_out);
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Verify the logical dump at `path` (`path_len` UTF-8 bytes) without
|
|
504
|
+
* writing anything: every file must match its manifest length, SHA-256 and
|
|
505
|
+
* record count. On success returns true and `report_out` receives
|
|
506
|
+
* `{"dump_format_version", "source_hawdb_version",
|
|
507
|
+
* "source_persistent_format_version", "branch", "commit_epoch",
|
|
508
|
+
* "table_count", "table_row_count", "node_count", "relationship_count",
|
|
509
|
+
* "file_count", "total_bytes", "manifest_sha256"}`; `manifest_sha256`
|
|
510
|
+
* equals the export report's for the dump that export wrote. A damaged or
|
|
511
|
+
* incomplete dump fails with `storage_integrity`, a newer one with
|
|
512
|
+
* `unsupported_storage_format`.
|
|
513
|
+
*
|
|
514
|
+
* # Safety
|
|
515
|
+
* `path` must be readable for `path_len` bytes or NULL; `report_out` and
|
|
516
|
+
* `err_out` must be NULL or writable [`HawdbBuffer`] storage.
|
|
517
|
+
*/
|
|
518
|
+
bool hawdb_verify_dump(const char *path,
|
|
519
|
+
uintptr_t path_len,
|
|
520
|
+
struct HawdbBuffer *report_out,
|
|
521
|
+
struct HawdbBuffer *err_out);
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Reconcile an export or import that failed with `publish_outcome_unknown`:
|
|
525
|
+
* check that `dest_path` is a directory and synchronize it and its parent,
|
|
526
|
+
* so the published name survives a crash once this returns true.
|
|
527
|
+
* Idempotent; it never changes or removes content. It does not judge the
|
|
528
|
+
* content: verify an export with [`hawdb_verify_dump`], open an import. If
|
|
529
|
+
* `dest_path` is missing, the publication did not survive and the call can
|
|
530
|
+
* be run again. On failure returns false and fills `err_out`.
|
|
531
|
+
*
|
|
532
|
+
* # Safety
|
|
533
|
+
* `dest_path` must be readable for `dest_len` bytes or NULL; `err_out` must
|
|
534
|
+
* be NULL or writable [`HawdbBuffer`] storage.
|
|
535
|
+
*/
|
|
536
|
+
bool hawdb_confirm_dump_publication(const char *dest_path,
|
|
537
|
+
uintptr_t dest_len,
|
|
538
|
+
struct HawdbBuffer *err_out);
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Write a consistent, self-verifying backup of an open database to
|
|
542
|
+
* `dest_path`, a directory that must not exist yet (its parent must).
|
|
543
|
+
*
|
|
544
|
+
* The database first checkpoints, so the backup holds every transaction
|
|
545
|
+
* committed before the call; the handle stays open and usable. Writes are
|
|
546
|
+
* paused for the duration of the call. Requires a writable persistent
|
|
547
|
+
* handle: a read-only or in-memory handle, an open transaction
|
|
548
|
+
* (`transaction_open`) or an existing destination fail without writing a
|
|
549
|
+
* backup.
|
|
550
|
+
*
|
|
551
|
+
* On success returns true and `report_out` receives
|
|
552
|
+
* `{"generation", "checkpoint_commit_epoch", "file_count", "total_bytes",
|
|
553
|
+
* "manifest_checksum"}` (unsigned 64-bit integers; preserve their
|
|
554
|
+
* precision). On failure returns false and fills `err_out`.
|
|
555
|
+
*
|
|
556
|
+
* # Safety
|
|
557
|
+
* `db` must be a live [`super::hawdb_open`] handle; `dest_path` must be
|
|
558
|
+
* readable for `dest_len` bytes or NULL; `report_out` and `err_out` must be
|
|
559
|
+
* NULL or writable [`HawdbBuffer`] storage.
|
|
560
|
+
*/
|
|
561
|
+
bool hawdb_backup(struct HawdbDatabase *db,
|
|
562
|
+
const char *dest_path,
|
|
563
|
+
uintptr_t dest_len,
|
|
564
|
+
struct HawdbBuffer *report_out,
|
|
565
|
+
struct HawdbBuffer *err_out);
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Restore the backup directory at `src_path` into `dest_path`, a new
|
|
569
|
+
* directory that must not exist yet. Every backup file is verified against
|
|
570
|
+
* the backup manifest (length, CRC32C and SHA-256) before anything is
|
|
571
|
+
* written; the result is an ordinary database to open with
|
|
572
|
+
* [`super::hawdb_open`]. No database handle is needed, and the backup is
|
|
573
|
+
* never modified.
|
|
574
|
+
*
|
|
575
|
+
* On success returns true and `report_out` receives
|
|
576
|
+
* `{"generation", "checkpoint_commit_epoch", "file_count", "total_bytes",
|
|
577
|
+
* "manifest_checksum"}`, matching the [`hawdb_backup`] report of the same
|
|
578
|
+
* backup. A damaged or incomplete backup fails without creating
|
|
579
|
+
* `dest_path`.
|
|
580
|
+
*
|
|
581
|
+
* # Safety
|
|
582
|
+
* `src_path` and `dest_path` must be readable for `src_len` / `dest_len`
|
|
583
|
+
* bytes or NULL; `report_out` and `err_out` must be NULL or writable
|
|
584
|
+
* [`HawdbBuffer`] storage.
|
|
585
|
+
*/
|
|
586
|
+
bool hawdb_restore(const char *src_path,
|
|
587
|
+
uintptr_t src_len,
|
|
588
|
+
const char *dest_path,
|
|
589
|
+
uintptr_t dest_len,
|
|
590
|
+
struct HawdbBuffer *report_out,
|
|
591
|
+
struct HawdbBuffer *err_out);
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Verify every durable file of the open database's published generation
|
|
595
|
+
* and its WAL against their recorded checksums (CRC32C, and SHA-256 where
|
|
596
|
+
* recorded), streaming without loading the database.
|
|
597
|
+
*
|
|
598
|
+
* On success returns true and `report_out` receives
|
|
599
|
+
* `{"generation", "checked_file_count", "checked_bytes",
|
|
600
|
+
* "sha256_verified_file_count", "wal_record_count", "wal_bytes"}`.
|
|
601
|
+
* Damage fails with the engine's storage error kind and a message naming
|
|
602
|
+
* the mismatch; the handle is then poisoned so that later statements fail
|
|
603
|
+
* until it is closed and the database reopened (or restored from a
|
|
604
|
+
* backup). An in-memory handle or an open transaction (`transaction_open`)
|
|
605
|
+
* fails without scrubbing. Read-only handles can be scrubbed.
|
|
606
|
+
*
|
|
607
|
+
* # Safety
|
|
608
|
+
* `db` must be a live [`super::hawdb_open`] handle; `report_out` and
|
|
609
|
+
* `err_out` must be NULL or writable [`HawdbBuffer`] storage.
|
|
610
|
+
*/
|
|
611
|
+
bool hawdb_scrub(struct HawdbDatabase *db,
|
|
612
|
+
struct HawdbBuffer *report_out,
|
|
613
|
+
struct HawdbBuffer *err_out);
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Return the additive experimental retained descriptor ABI version.
|
|
617
|
+
*/
|
|
618
|
+
uint32_t hawdb_retained_abi_version(void);
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Create an eligible experimental cursor. There is no copying fallback or JSON
|
|
622
|
+
* result encoding. Parameter JSON remains an input format.
|
|
623
|
+
*
|
|
624
|
+
* # Safety
|
|
625
|
+
* db must remain live for this call. request must be aligned/readable for
|
|
626
|
+
* request_size bytes, with valid pointed-to input ranges. out must be aligned
|
|
627
|
+
* and writable for out_size bytes. Keep the library loaded until final release.
|
|
628
|
+
*/
|
|
629
|
+
uint32_t hawdb_retained_query(struct HawdbDatabase *db,
|
|
630
|
+
const struct HawdbRetainedQueryV1 *request,
|
|
631
|
+
uint32_t request_size,
|
|
632
|
+
struct HawdbRetainedCursorV1 *out,
|
|
633
|
+
uint32_t out_size);
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Pull serially with no prefetch. Backpressure precedes source advancement and
|
|
637
|
+
* EOF carries an empty output. Earlier batches remain provisional until EOF.
|
|
638
|
+
*
|
|
639
|
+
* # Safety
|
|
640
|
+
* out must be aligned/writable for out_size bytes. Do not release a handle
|
|
641
|
+
* concurrently with access to its borrowed payload pointers.
|
|
642
|
+
*/
|
|
643
|
+
uint32_t hawdb_retained_next(uint64_t owner_namespace,
|
|
644
|
+
uint64_t owner_id,
|
|
645
|
+
struct HawdbRetainedBatchV1 *out,
|
|
646
|
+
uint32_t out_size);
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Return borrowed schema, including before the first pull or after empty EOF.
|
|
650
|
+
*
|
|
651
|
+
* # Safety
|
|
652
|
+
* out must be aligned/writable for out_size bytes. Schema names expire when
|
|
653
|
+
* the supplied owner is released; retain its owner during all reads.
|
|
654
|
+
*/
|
|
655
|
+
uint32_t hawdb_retained_schema(uint64_t owner_namespace,
|
|
656
|
+
uint64_t owner_id,
|
|
657
|
+
uint64_t column,
|
|
658
|
+
struct HawdbRetainedSchemaV1 *out,
|
|
659
|
+
uint32_t out_size);
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Create an independent immutable column owner without copying payload.
|
|
663
|
+
*
|
|
664
|
+
* # Safety
|
|
665
|
+
* out must be aligned/writable for out_size bytes. Pointers remain readable
|
|
666
|
+
* until this returned column owner is released, including after parent close.
|
|
667
|
+
*/
|
|
668
|
+
uint32_t hawdb_retained_column(uint64_t owner_namespace,
|
|
669
|
+
uint64_t owner_id,
|
|
670
|
+
uint64_t column,
|
|
671
|
+
struct HawdbRetainedColumnV1 *out,
|
|
672
|
+
uint32_t out_size);
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Borrow a column from a batch without allocating or admitting another owner.
|
|
676
|
+
* Its descriptor capacity was prepaid during the pull. This permits consuming
|
|
677
|
+
* a held batch even when no additional independently owned view can be admitted.
|
|
678
|
+
*
|
|
679
|
+
* # Safety
|
|
680
|
+
* out must be aligned/writable for out_size bytes. The supplied batch must
|
|
681
|
+
* remain live throughout every pointer read. A BORROWED descriptor must not be
|
|
682
|
+
* released independently; its owner_id is zero, a non-owning sentinel.
|
|
683
|
+
*/
|
|
684
|
+
uint32_t hawdb_retained_column_borrow(uint64_t owner_namespace,
|
|
685
|
+
uint64_t owner_id,
|
|
686
|
+
uint64_t column,
|
|
687
|
+
struct HawdbRetainedColumnV1 *out,
|
|
688
|
+
uint32_t out_size);
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Retain an independent batch owner. Cursor and column handles refuse; columns
|
|
692
|
+
* have their own export function and release lifetime.
|
|
693
|
+
*
|
|
694
|
+
* # Safety
|
|
695
|
+
* out must be aligned/writable for out_size bytes. Do not release its returned
|
|
696
|
+
* owner until all reads through the descriptor have finished.
|
|
697
|
+
*/
|
|
698
|
+
uint32_t hawdb_retained_batch_retain(uint64_t owner_namespace,
|
|
699
|
+
uint64_t owner_id,
|
|
700
|
+
struct HawdbRetainedBatchV1 *out,
|
|
701
|
+
uint32_t out_size);
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Retain an independent column owner, preserving all allocation identities and
|
|
705
|
+
* ranges. Admission failure leaves the original column readable.
|
|
706
|
+
*
|
|
707
|
+
* # Safety
|
|
708
|
+
* out must be aligned/writable for out_size bytes. Release this new owner after
|
|
709
|
+
* all reads, independently of the original column's owner.
|
|
710
|
+
*/
|
|
711
|
+
uint32_t hawdb_retained_column_retain(uint64_t owner_namespace,
|
|
712
|
+
uint64_t owner_id,
|
|
713
|
+
struct HawdbRetainedColumnV1 *out,
|
|
714
|
+
uint32_t out_size);
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Read current terminal state. A prior descriptor's scalar status must not be
|
|
718
|
+
* treated as final; this function observes late failures through retained views.
|
|
719
|
+
*
|
|
720
|
+
* # Safety
|
|
721
|
+
* out must be aligned/writable for out_size bytes.
|
|
722
|
+
*/
|
|
723
|
+
uint32_t hawdb_retained_state(uint64_t owner_namespace,
|
|
724
|
+
uint64_t owner_id,
|
|
725
|
+
struct HawdbRetainedStateV1 *out,
|
|
726
|
+
uint32_t out_size);
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Close a cursor and its source without revoking previously exported payload.
|
|
730
|
+
* Release the closed cursor handle separately. Repeated close is harmless.
|
|
731
|
+
*/
|
|
732
|
+
uint32_t hawdb_retained_cursor_close(uint64_t owner_namespace, uint64_t owner_id);
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Release exactly one owner. Stale, foreign-module and unknown handles return
|
|
736
|
+
* InvalidHandle without dereferencing caller-provided addresses.
|
|
737
|
+
*/
|
|
738
|
+
uint32_t hawdb_retained_release(uint64_t owner_namespace, uint64_t owner_id);
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Open a strict single-match indexed node cursor. Input parameters use JSON;
|
|
742
|
+
* results never do. All layout refusals are inherited from the native planner.
|
|
743
|
+
*
|
|
744
|
+
* # Safety
|
|
745
|
+
* db/request must be valid for this call. out must be aligned and writable for
|
|
746
|
+
* out_size bytes. The library mapping must outlive every returned owner.
|
|
747
|
+
*/
|
|
748
|
+
uint32_t hawdb_retained_node_query(struct HawdbDatabase *db,
|
|
749
|
+
const struct HawdbRetainedQueryV1 *request,
|
|
750
|
+
uint32_t request_size,
|
|
751
|
+
struct HawdbRetainedCursorV1 *out,
|
|
752
|
+
uint32_t out_size);
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Pull one independently owned node. EOF completes provisional values. A failed
|
|
756
|
+
* registration aborts delivery rather than allowing a later successful EOF.
|
|
757
|
+
*
|
|
758
|
+
* # Safety
|
|
759
|
+
* out must be aligned/writable for out_size bytes. Returned pointers remain
|
|
760
|
+
* readable until their owner is released; synchronize release with all reads.
|
|
761
|
+
*/
|
|
762
|
+
uint32_t hawdb_retained_node_next(uint64_t owner_namespace,
|
|
763
|
+
uint64_t owner_id,
|
|
764
|
+
struct HawdbRetainedNodeV1 *out,
|
|
765
|
+
uint32_t out_size);
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Create an independent child owner. Node ordering is _id, labels, then native
|
|
769
|
+
* sorted properties. Lists use index order; maps use native sorted key order.
|
|
770
|
+
*
|
|
771
|
+
* # Safety
|
|
772
|
+
* out must be aligned/writable for out_size bytes. Synchronize pointer reads
|
|
773
|
+
* with release. A child survives release of all its ancestors and database.
|
|
774
|
+
*/
|
|
775
|
+
uint32_t hawdb_retained_node_child(uint64_t owner_namespace,
|
|
776
|
+
uint64_t owner_id,
|
|
777
|
+
uint64_t index,
|
|
778
|
+
struct HawdbRetainedNodeV1 *out,
|
|
779
|
+
uint32_t out_size);
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Look up a node/map field without cloning its key or payload. Missing fields
|
|
783
|
+
* return InvalidColumn and an empty output; other payload kinds refuse.
|
|
784
|
+
*
|
|
785
|
+
* # Safety
|
|
786
|
+
* name must be readable UTF-8 for name_len bytes. out must be aligned/writable
|
|
787
|
+
* for out_size bytes. Synchronize returned pointer reads with owner release.
|
|
788
|
+
*/
|
|
789
|
+
uint32_t hawdb_retained_node_field(uint64_t owner_namespace,
|
|
790
|
+
uint64_t owner_id,
|
|
791
|
+
const char *name,
|
|
792
|
+
uint64_t name_len,
|
|
793
|
+
struct HawdbRetainedNodeV1 *out,
|
|
794
|
+
uint32_t out_size);
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Retain an independent owner, preserving pointer identity and path.
|
|
798
|
+
*
|
|
799
|
+
* # Safety
|
|
800
|
+
* out must be aligned/writable for out_size bytes. Release its owner only after
|
|
801
|
+
* all pointer reads finish, independently of the original owner.
|
|
802
|
+
*/
|
|
803
|
+
uint32_t hawdb_retained_node_retain(uint64_t owner_namespace,
|
|
804
|
+
uint64_t owner_id,
|
|
805
|
+
struct HawdbRetainedNodeV1 *out,
|
|
806
|
+
uint32_t out_size);
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Begin a user transaction on `db`.
|
|
810
|
+
*
|
|
811
|
+
* Statements then run through [`hawdb_transaction_query`] and
|
|
812
|
+
* [`hawdb_transaction_query_sql`], see their own writes, and become durable
|
|
813
|
+
* and visible to other readers only together, at
|
|
814
|
+
* [`hawdb_commit_transaction`]. [`hawdb_rollback_transaction`] discards
|
|
815
|
+
* them. While the transaction is open, [`hawdb_query`] and
|
|
816
|
+
* [`hawdb_query_sql`] on this handle fail with `transaction_open`.
|
|
817
|
+
*
|
|
818
|
+
* Returns true on success. Fails with `transaction_open` if a transaction
|
|
819
|
+
* is already open on the handle (there is no nesting) and with the engine's
|
|
820
|
+
* own error kind if the database cannot start one (for example a read-only
|
|
821
|
+
* open).
|
|
822
|
+
*
|
|
823
|
+
* # Safety
|
|
824
|
+
* `db` must be a live [`super::hawdb_open`] handle; `err_out` must be NULL
|
|
825
|
+
* or writable [`HawdbBuffer`] storage.
|
|
826
|
+
*/
|
|
827
|
+
bool hawdb_begin_transaction(struct HawdbDatabase *db, struct HawdbBuffer *err_out);
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Run one Cypher statement inside the open transaction.
|
|
831
|
+
*
|
|
832
|
+
* Arguments, value encoding and result/error conventions match
|
|
833
|
+
* [`super::hawdb_query`]. Fails with `no_transaction` when no transaction is
|
|
834
|
+
* open. A failed statement leaves the transaction open; roll it back (a
|
|
835
|
+
* later commit may also refuse it).
|
|
836
|
+
*
|
|
837
|
+
* # Safety
|
|
838
|
+
* Same contract as [`super::hawdb_query`].
|
|
839
|
+
*/
|
|
840
|
+
bool hawdb_transaction_query(struct HawdbDatabase *db,
|
|
841
|
+
const char *cypher,
|
|
842
|
+
uintptr_t cypher_len,
|
|
843
|
+
const char *params_json,
|
|
844
|
+
uintptr_t params_len,
|
|
845
|
+
struct HawdbBuffer *result_out,
|
|
846
|
+
struct HawdbBuffer *err_out);
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Run one SQL statement inside the open transaction.
|
|
850
|
+
*
|
|
851
|
+
* Arguments, value encoding and result/error conventions match
|
|
852
|
+
* [`super::hawdb_query_sql`]; otherwise behaves like
|
|
853
|
+
* [`hawdb_transaction_query`].
|
|
854
|
+
*
|
|
855
|
+
* # Safety
|
|
856
|
+
* Same contract as [`super::hawdb_query`].
|
|
857
|
+
*/
|
|
858
|
+
bool hawdb_transaction_query_sql(struct HawdbDatabase *db,
|
|
859
|
+
const char *sql,
|
|
860
|
+
uintptr_t sql_len,
|
|
861
|
+
const char *params_json,
|
|
862
|
+
uintptr_t params_len,
|
|
863
|
+
struct HawdbBuffer *result_out,
|
|
864
|
+
struct HawdbBuffer *err_out);
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Commit the open transaction as one durable commit.
|
|
868
|
+
*
|
|
869
|
+
* On success returns true and `result_out` receives the commit's result
|
|
870
|
+
* envelope (`{"columns": [...], "rows": [...]}`), and every statement is
|
|
871
|
+
* committed, durable under the handle's `durability` option. The
|
|
872
|
+
* transaction is closed after this call whether or not it succeeds. The
|
|
873
|
+
* commit is all or nothing, never partial: a commit refused before
|
|
874
|
+
* publication (for example a write conflict or a budget refusal)
|
|
875
|
+
* publishes none of its statements, but an error raised while publishing,
|
|
876
|
+
* or a crash before this call returns, leaves the outcome unknown, and
|
|
877
|
+
* recovery may show the whole transaction committed. Reconcile or retry
|
|
878
|
+
* idempotently; a missing acknowledgment is not proof of rollback.
|
|
879
|
+
* Fails with `no_transaction` when no transaction is open.
|
|
880
|
+
*
|
|
881
|
+
* # Safety
|
|
882
|
+
* `db` must be a live [`super::hawdb_open`] handle; `result_out` and
|
|
883
|
+
* `err_out` must be NULL or writable [`HawdbBuffer`] storage.
|
|
884
|
+
*/
|
|
885
|
+
bool hawdb_commit_transaction(struct HawdbDatabase *db,
|
|
886
|
+
struct HawdbBuffer *result_out,
|
|
887
|
+
struct HawdbBuffer *err_out);
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Roll back the open transaction, discarding all of its statements.
|
|
891
|
+
* Fails with `no_transaction` when no transaction is open.
|
|
892
|
+
*
|
|
893
|
+
* # Safety
|
|
894
|
+
* `db` must be a live [`super::hawdb_open`] handle; `err_out` must be NULL
|
|
895
|
+
* or writable [`HawdbBuffer`] storage.
|
|
896
|
+
*/
|
|
897
|
+
bool hawdb_rollback_transaction(struct HawdbDatabase *db, struct HawdbBuffer *err_out);
|
package/libhawdb_ffi.so
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nowledge/hawdb-ffi-linux-arm64-gnu",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.34.0",
|
|
4
|
+
"description": "Prebuilt HawDB C ABI shared library for aarch64-unknown-linux-gnu",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/nowledge-co/hawdb.git",
|
|
9
|
+
"directory": "bindings/ffi"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/nowledge-co/hawdb/blob/main/docs/PREBUILT_LIBRARIES.md",
|
|
12
|
+
"os": [
|
|
13
|
+
"linux"
|
|
14
|
+
],
|
|
15
|
+
"cpu": [
|
|
16
|
+
"arm64"
|
|
17
|
+
],
|
|
18
|
+
"libc": [
|
|
19
|
+
"glibc"
|
|
20
|
+
],
|
|
21
|
+
"files": [
|
|
22
|
+
"libhawdb_ffi.so",
|
|
23
|
+
"hawdb_ffi.h",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
}
|
|
30
|
+
}
|