@ahmadmoussawi/webdb 0.0.0-stage → 0.1.1
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/README.md +386 -2
- package/dist/constants.d.ts +18 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/js/buffer_pool.c.d.ts +142 -0
- package/dist/core/js/buffer_pool.c.d.ts.map +1 -0
- package/dist/core/js/catalog.c.d.ts +186 -0
- package/dist/core/js/catalog.c.d.ts.map +1 -0
- package/dist/core/js/codecs.c.d.ts +32 -0
- package/dist/core/js/codecs.c.d.ts.map +1 -0
- package/dist/core/js/index.d.ts +7 -0
- package/dist/core/js/index.d.ts.map +1 -0
- package/dist/core/js/page.c.d.ts +229 -0
- package/dist/core/js/page.c.d.ts.map +1 -0
- package/dist/core/js/page_table.c.d.ts +48 -0
- package/dist/core/js/page_table.c.d.ts.map +1 -0
- package/dist/core/js/vm.c.d.ts +11 -0
- package/dist/core/js/vm.c.d.ts.map +1 -0
- package/dist/core/js/vm.helpers.c.d.ts +124 -0
- package/dist/core/js/vm.helpers.c.d.ts.map +1 -0
- package/dist/core/types.d.ts +26 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/wasm/embedded_wasm.d.ts +7 -0
- package/dist/core/wasm/embedded_wasm.d.ts.map +1 -0
- package/dist/core/wasm/wasm_core.d.ts +75 -0
- package/dist/core/wasm/wasm_core.d.ts.map +1 -0
- package/dist/host/api/index.d.ts +3 -0
- package/dist/host/api/index.d.ts.map +1 -0
- package/dist/host/api/query_builder.d.ts +216 -0
- package/dist/host/api/query_builder.d.ts.map +1 -0
- package/dist/host/api/webdb.d.ts +172 -0
- package/dist/host/api/webdb.d.ts.map +1 -0
- package/dist/host/compiler/compiler.d.ts +151 -0
- package/dist/host/compiler/compiler.d.ts.map +1 -0
- package/dist/host/compiler/expr_parser.d.ts +87 -0
- package/dist/host/compiler/expr_parser.d.ts.map +1 -0
- package/dist/host/compiler/index.d.ts +4 -0
- package/dist/host/compiler/index.d.ts.map +1 -0
- package/dist/host/compiler/planner/cost.d.ts +23 -0
- package/dist/host/compiler/planner/cost.d.ts.map +1 -0
- package/dist/host/compiler/planner/custom_order.d.ts +16 -0
- package/dist/host/compiler/planner/custom_order.d.ts.map +1 -0
- package/dist/host/compiler/planner/heuristic.d.ts +11 -0
- package/dist/host/compiler/planner/heuristic.d.ts.map +1 -0
- package/dist/host/compiler/planner/index.d.ts +34 -0
- package/dist/host/compiler/planner/index.d.ts.map +1 -0
- package/dist/host/compiler/planner/noop.d.ts +11 -0
- package/dist/host/compiler/planner/noop.d.ts.map +1 -0
- package/dist/host/compiler/planner/types.d.ts +100 -0
- package/dist/host/compiler/planner/types.d.ts.map +1 -0
- package/dist/host/compiler/planner/where_optimizer.d.ts +30 -0
- package/dist/host/compiler/planner/where_optimizer.d.ts.map +1 -0
- package/dist/host/compiler/planner.d.ts +2 -0
- package/dist/host/compiler/planner.d.ts.map +1 -0
- package/dist/host/driver/buffer_pool_driver.d.ts +94 -0
- package/dist/host/driver/buffer_pool_driver.d.ts.map +1 -0
- package/dist/host/driver/crash_recovery.d.ts +24 -0
- package/dist/host/driver/crash_recovery.d.ts.map +1 -0
- package/dist/host/driver/index.d.ts +4 -0
- package/dist/host/driver/index.d.ts.map +1 -0
- package/dist/host/driver/transaction_coordinator.d.ts +166 -0
- package/dist/host/driver/transaction_coordinator.d.ts.map +1 -0
- package/dist/host/storage/crc32.d.ts +24 -0
- package/dist/host/storage/crc32.d.ts.map +1 -0
- package/dist/host/storage/idb.d.ts +27 -0
- package/dist/host/storage/idb.d.ts.map +1 -0
- package/dist/host/storage/index.d.ts +8 -0
- package/dist/host/storage/index.d.ts.map +1 -0
- package/dist/host/storage/io.d.ts +60 -0
- package/dist/host/storage/io.d.ts.map +1 -0
- package/dist/host/storage/memory.d.ts +28 -0
- package/dist/host/storage/memory.d.ts.map +1 -0
- package/dist/host/storage/opfs.d.ts +31 -0
- package/dist/host/storage/opfs.d.ts.map +1 -0
- package/dist/host/storage/vfs.d.ts +36 -0
- package/dist/host/storage/vfs.d.ts.map +1 -0
- package/dist/host/storage/wal_codec.d.ts +56 -0
- package/dist/host/storage/wal_codec.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/layouts/index.d.ts +5 -0
- package/dist/layouts/index.d.ts.map +1 -0
- package/dist/layouts/page_format.d.ts +163 -0
- package/dist/layouts/page_format.d.ts.map +1 -0
- package/dist/layouts/pool_format.d.ts +126 -0
- package/dist/layouts/pool_format.d.ts.map +1 -0
- package/dist/layouts/syspage_format.d.ts +499 -0
- package/dist/layouts/syspage_format.d.ts.map +1 -0
- package/dist/layouts/wal_format.d.ts +197 -0
- package/dist/layouts/wal_format.d.ts.map +1 -0
- package/dist/shared/c_runtime.d.ts +47 -0
- package/dist/shared/c_runtime.d.ts.map +1 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/page_provider.d.ts +12 -0
- package/dist/shared/page_provider.d.ts.map +1 -0
- package/dist/shared/vm_context.d.ts +73 -0
- package/dist/shared/vm_context.d.ts.map +1 -0
- package/dist/types/index.d.ts +338 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/webdb.js +13059 -0
- package/dist/webdb.js.map +1 -0
- package/dist/webdb.umd.cjs +5 -0
- package/dist/webdb.umd.cjs.map +1 -0
- package/package.json +82 -4
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-GENERATED AT BUILD TIME FROM src/layouts/schemas/wal_format.json
|
|
3
|
+
* DO NOT EDIT MANUALLY. Run 'npm run generate:layouts' to rebuild.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* ============================================================================
|
|
7
|
+
* CRITICAL WARNING: FROZEN WAL BINARY FORMAT SPECIFICATION
|
|
8
|
+
* DO NOT modify the order, types, or byte lengths of existing fields in
|
|
9
|
+
* WalFileHeader or WalFrameHeader! Changing any offset or field size breaks
|
|
10
|
+
* binary determinism, prevents crash recovery, and corrupts WAL logs.
|
|
11
|
+
*
|
|
12
|
+
* Both the WAL file header (32 bytes) and WAL frame headers (32 bytes)
|
|
13
|
+
* must remain rigidly 8-byte aligned.
|
|
14
|
+
* ============================================================================
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Rigid page payload size in bytes per WAL frame (4096 bytes).
|
|
18
|
+
*/
|
|
19
|
+
export declare const WAL_PAGE_SIZE = 4096;
|
|
20
|
+
/**
|
|
21
|
+
* Total size in bytes of a single WAL frame (32-byte header + 4096-byte page payload = 4128 bytes).
|
|
22
|
+
*/
|
|
23
|
+
export declare const WAL_FRAME_SIZE = 4128;
|
|
24
|
+
/**
|
|
25
|
+
* Current WAL file format version (Version 1).
|
|
26
|
+
*/
|
|
27
|
+
export declare const WAL_CURRENT_VERSION = 1;
|
|
28
|
+
/**
|
|
29
|
+
* Magic number for WAL frames (0x57414C46 in uint32 LE = 'WALF').
|
|
30
|
+
*/
|
|
31
|
+
export declare const WAL_FRAME_MAGIC = 1463897158;
|
|
32
|
+
/**
|
|
33
|
+
* Frame type 0x0001: Committed 4KB page mutation for page_id.
|
|
34
|
+
*/
|
|
35
|
+
export declare const WAL_FRAME_TYPE_PAGE_DATA = 1;
|
|
36
|
+
/**
|
|
37
|
+
* Frame type 0x0002: Commit marker for tx_id. Signals that all preceding frames for this tx_id are permanently committed.
|
|
38
|
+
*/
|
|
39
|
+
export declare const WAL_FRAME_TYPE_TX_COMMIT = 2;
|
|
40
|
+
/**
|
|
41
|
+
* Frame type 0x0003: Cache spill frame under memory pressure. Ignored during recovery unless followed by a commit marker.
|
|
42
|
+
*/
|
|
43
|
+
export declare const WAL_FRAME_TYPE_TX_UNCOMMITTED = 3;
|
|
44
|
+
/**
|
|
45
|
+
* 32-bit Word Byte Layout Grid for WAL_FILE_HEADER:
|
|
46
|
+
* Byte 0 Byte 1 Byte 2 Byte 3
|
|
47
|
+
* +-----------------+-----------------+-----------------+-----------------+
|
|
48
|
+
* | MAGIC [0..3] |
|
|
49
|
+
* +-----------------------------------------------------------------------+
|
|
50
|
+
* | MAGIC [4..5] | WAL_VERSION (2B) |
|
|
51
|
+
* +-----------------------------------+-----------------------------------+
|
|
52
|
+
* | PAGE_SIZE (4B) |
|
|
53
|
+
* +-----------------------------------------------------------------------+
|
|
54
|
+
* | CHECKPOINT_SEQ (4B) |
|
|
55
|
+
* +-----------------------------------------------------------------------+
|
|
56
|
+
* | SALT1 (4B) |
|
|
57
|
+
* +-----------------------------------------------------------------------+
|
|
58
|
+
* | SALT2 (4B) |
|
|
59
|
+
* +-----------------------------------------------------------------------+
|
|
60
|
+
* | CHECKSUM (4B) |
|
|
61
|
+
* +-----------------------------------------------------------------------+
|
|
62
|
+
* | RESERVED (4B) |
|
|
63
|
+
* +-----------------------------------------------------------------------+
|
|
64
|
+
*
|
|
65
|
+
* Field Details:
|
|
66
|
+
* +--------+------+----------------+----------+------------------------------------------------+
|
|
67
|
+
* | Offset | Size | Field Name | Type | Description |
|
|
68
|
+
* +--------+------+----------------+----------+------------------------------------------------+
|
|
69
|
+
* | 0 | 6B | MAGIC | char[6] | Magic string identifier 'WEBWAL' |
|
|
70
|
+
* | 6 | 2B | WAL_VERSION | uint16_t | WAL format version (1 for V1, uint16 LE) |
|
|
71
|
+
* | 8 | 4B | PAGE_SIZE | uint32_t | Rigid page size (4096, uint32 LE) |
|
|
72
|
+
* | 12 | 4B | CHECKPOINT_SEQ | uint32_t | Monotonic checkpoint counter (uint32 LE) |
|
|
73
|
+
* | 16 | 4B | SALT1 | uint32_t | Random salt generated on checkpoint (uint32... |
|
|
74
|
+
* | 20 | 4B | SALT2 | uint32_t | Random salt tie-breaker (uint32 LE) |
|
|
75
|
+
* | 24 | 4B | CHECKSUM | uint32_t | CRC32 checksum over bytes 0..23 (uint32 LE) |
|
|
76
|
+
* | 28 | 4B | RESERVED | uint32_t | Zero padding for 8-byte alignment (uint32 LE) |
|
|
77
|
+
* +--------+------+----------------+----------+------------------------------------------------+
|
|
78
|
+
* | Total: 32 Bytes |
|
|
79
|
+
* +--------------------------------------------------------------------------------------------+
|
|
80
|
+
*/
|
|
81
|
+
export declare const WAL_FILE_HEADER_FIELDS: readonly [readonly ["MAGIC", 6], readonly ["WAL_VERSION", 2], readonly ["PAGE_SIZE", 4], readonly ["CHECKPOINT_SEQ", 4], readonly ["SALT1", 4], readonly ["SALT2", 4], readonly ["CHECKSUM", 4], readonly ["RESERVED", 4]];
|
|
82
|
+
/**
|
|
83
|
+
* Total size in bytes of the WAL file header (32 bytes).
|
|
84
|
+
*/
|
|
85
|
+
export declare const WAL_FILE_HEADER_SIZE = 32;
|
|
86
|
+
/**
|
|
87
|
+
* 0..5: Magic string identifier 'WEBWAL'
|
|
88
|
+
*/
|
|
89
|
+
export declare const WAL_HEADER_OFFSET_MAGIC = 0;
|
|
90
|
+
/**
|
|
91
|
+
* 6..7: WAL format version (1 for V1, uint16 LE)
|
|
92
|
+
*/
|
|
93
|
+
export declare const WAL_HEADER_OFFSET_WAL_VERSION = 6;
|
|
94
|
+
/**
|
|
95
|
+
* 8..11: Rigid page size (4096, uint32 LE)
|
|
96
|
+
*/
|
|
97
|
+
export declare const WAL_HEADER_OFFSET_PAGE_SIZE = 8;
|
|
98
|
+
/**
|
|
99
|
+
* 12..15: Monotonic checkpoint counter (uint32 LE)
|
|
100
|
+
*/
|
|
101
|
+
export declare const WAL_HEADER_OFFSET_CHECKPOINT_SEQ = 12;
|
|
102
|
+
/**
|
|
103
|
+
* 16..19: Random salt generated on checkpoint (uint32 LE)
|
|
104
|
+
*/
|
|
105
|
+
export declare const WAL_HEADER_OFFSET_SALT1 = 16;
|
|
106
|
+
/**
|
|
107
|
+
* 20..23: Random salt tie-breaker (uint32 LE)
|
|
108
|
+
*/
|
|
109
|
+
export declare const WAL_HEADER_OFFSET_SALT2 = 20;
|
|
110
|
+
/**
|
|
111
|
+
* 24..27: CRC32 checksum over bytes 0..23 (uint32 LE)
|
|
112
|
+
*/
|
|
113
|
+
export declare const WAL_HEADER_OFFSET_CHECKSUM = 24;
|
|
114
|
+
/**
|
|
115
|
+
* 28..31: Zero padding for 8-byte alignment (uint32 LE)
|
|
116
|
+
*/
|
|
117
|
+
export declare const WAL_HEADER_OFFSET_RESERVED = 28;
|
|
118
|
+
/**
|
|
119
|
+
* 32-bit Word Byte Layout Grid for WAL_FRAME_HEADER:
|
|
120
|
+
* Byte 0 Byte 1 Byte 2 Byte 3
|
|
121
|
+
* +-----------------+-----------------+-----------------+-----------------+
|
|
122
|
+
* | MAGIC (4B) |
|
|
123
|
+
* +-----------------------------------------------------------------------+
|
|
124
|
+
* | FRAME_TYPE (2B) | FLAGS (2B) |
|
|
125
|
+
* +-----------------------------------+-----------------------------------+
|
|
126
|
+
* | TX_ID (4B) |
|
|
127
|
+
* +-----------------------------------------------------------------------+
|
|
128
|
+
* | PAGE_ID (4B) |
|
|
129
|
+
* +-----------------------------------------------------------------------+
|
|
130
|
+
* | DB_SIZE_PAGES (4B) |
|
|
131
|
+
* +-----------------------------------------------------------------------+
|
|
132
|
+
* | FRAME_SEQ (4B) |
|
|
133
|
+
* +-----------------------------------------------------------------------+
|
|
134
|
+
* | CHECKSUM (4B) |
|
|
135
|
+
* +-----------------------------------------------------------------------+
|
|
136
|
+
* | RESERVED (4B) |
|
|
137
|
+
* +-----------------------------------------------------------------------+
|
|
138
|
+
*
|
|
139
|
+
* Field Details:
|
|
140
|
+
* +--------+------+---------------+----------+------------------------------------------------+
|
|
141
|
+
* | Offset | Size | Field Name | Type | Description |
|
|
142
|
+
* +--------+------+---------------+----------+------------------------------------------------+
|
|
143
|
+
* | 0 | 4B | MAGIC | uint32_t | Frame magic 0x57414C46 ('WALF', uint32 LE) |
|
|
144
|
+
* | 4 | 2B | FRAME_TYPE | uint16_t | Frame type (1=PAGE_DATA, 2=TX_COMMIT, 3=TX_... |
|
|
145
|
+
* | 6 | 2B | FLAGS | uint16_t | Reserved flags (0x0000, uint16 LE) |
|
|
146
|
+
* | 8 | 4B | TX_ID | uint32_t | Monotonic transaction identifier (uint32 LE) |
|
|
147
|
+
* | 12 | 4B | PAGE_ID | uint32_t | Target database Page ID (1..N, uint32 LE) |
|
|
148
|
+
* | 16 | 4B | DB_SIZE_PAGES | uint32_t | Size of DB in pages after commit (uint32 LE) |
|
|
149
|
+
* | 20 | 4B | FRAME_SEQ | uint32_t | Monotonic frame sequence counter in WAL (ui... |
|
|
150
|
+
* | 24 | 4B | CHECKSUM | uint32_t | CRC32 over header bytes 0..23 + 4096 page b... |
|
|
151
|
+
* | 28 | 4B | RESERVED | uint32_t | Zero padding for 8-byte alignment (uint32 LE) |
|
|
152
|
+
* +--------+------+---------------+----------+------------------------------------------------+
|
|
153
|
+
* | Total: 32 Bytes |
|
|
154
|
+
* +-------------------------------------------------------------------------------------------+
|
|
155
|
+
*/
|
|
156
|
+
export declare const WAL_FRAME_HEADER_FIELDS: readonly [readonly ["MAGIC", 4], readonly ["FRAME_TYPE", 2], readonly ["FLAGS", 2], readonly ["TX_ID", 4], readonly ["PAGE_ID", 4], readonly ["DB_SIZE_PAGES", 4], readonly ["FRAME_SEQ", 4], readonly ["CHECKSUM", 4], readonly ["RESERVED", 4]];
|
|
157
|
+
/**
|
|
158
|
+
* Total size in bytes of a single WAL frame header (32 bytes).
|
|
159
|
+
*/
|
|
160
|
+
export declare const WAL_FRAME_HEADER_SIZE = 32;
|
|
161
|
+
/**
|
|
162
|
+
* 0..3: Frame magic 0x57414C46 ('WALF', uint32 LE)
|
|
163
|
+
*/
|
|
164
|
+
export declare const WAL_FRAME_OFFSET_MAGIC = 0;
|
|
165
|
+
/**
|
|
166
|
+
* 4..5: Frame type (1=PAGE_DATA, 2=TX_COMMIT, 3=TX_UNCOMMITTED, uint16 LE)
|
|
167
|
+
*/
|
|
168
|
+
export declare const WAL_FRAME_OFFSET_FRAME_TYPE = 4;
|
|
169
|
+
/**
|
|
170
|
+
* 6..7: Reserved flags (0x0000, uint16 LE)
|
|
171
|
+
*/
|
|
172
|
+
export declare const WAL_FRAME_OFFSET_FLAGS = 6;
|
|
173
|
+
/**
|
|
174
|
+
* 8..11: Monotonic transaction identifier (uint32 LE)
|
|
175
|
+
*/
|
|
176
|
+
export declare const WAL_FRAME_OFFSET_TX_ID = 8;
|
|
177
|
+
/**
|
|
178
|
+
* 12..15: Target database Page ID (1..N, uint32 LE)
|
|
179
|
+
*/
|
|
180
|
+
export declare const WAL_FRAME_OFFSET_PAGE_ID = 12;
|
|
181
|
+
/**
|
|
182
|
+
* 16..19: Size of DB in pages after commit (uint32 LE)
|
|
183
|
+
*/
|
|
184
|
+
export declare const WAL_FRAME_OFFSET_DB_SIZE_PAGES = 16;
|
|
185
|
+
/**
|
|
186
|
+
* 20..23: Monotonic frame sequence counter in WAL (uint32 LE)
|
|
187
|
+
*/
|
|
188
|
+
export declare const WAL_FRAME_OFFSET_FRAME_SEQ = 20;
|
|
189
|
+
/**
|
|
190
|
+
* 24..27: CRC32 over header bytes 0..23 + 4096 page bytes (uint32 LE)
|
|
191
|
+
*/
|
|
192
|
+
export declare const WAL_FRAME_OFFSET_CHECKSUM = 24;
|
|
193
|
+
/**
|
|
194
|
+
* 28..31: Zero padding for 8-byte alignment (uint32 LE)
|
|
195
|
+
*/
|
|
196
|
+
export declare const WAL_FRAME_OFFSET_RESERVED = 28;
|
|
197
|
+
//# sourceMappingURL=wal_format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wal_format.d.ts","sourceRoot":"","sources":["../../src/layouts/wal_format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,OAAO,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;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AO,MAAM,0BAA0B,KAAK,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared C Runtime & Memory Helpers for WebAssembly Memory and Direct Buffers
|
|
3
|
+
*
|
|
4
|
+
* Provides drop-in C-standard library functions (memcpy, memset, memcmp)
|
|
5
|
+
* and pointer-dereferencing primitives (read_u32, write_u32, get_bit, set_bit, etc.)
|
|
6
|
+
* matching C99 / wasm32-nostdlib semantics.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* C: void *memcpy(void *dest, const void *src, size_t n);
|
|
10
|
+
* Copies n bytes from memory area src to memory area dest.
|
|
11
|
+
*/
|
|
12
|
+
export declare function memcpy(dest: Uint8Array | DataView, dest_offset: number, src: Uint8Array | DataView, src_offset: number, n: number): void;
|
|
13
|
+
/**
|
|
14
|
+
* C: void *memset(void *s, int c, size_t n);
|
|
15
|
+
* Fills the first n bytes of the memory area pointed to by s with the constant byte c.
|
|
16
|
+
*/
|
|
17
|
+
export declare function memset(dest: Uint8Array | DataView, dest_offset: number, c: number, n: number): void;
|
|
18
|
+
/**
|
|
19
|
+
* C: int memcmp(const void *s1, const void *s2, size_t n);
|
|
20
|
+
* Compares the first n bytes of the memory areas s1 and s2.
|
|
21
|
+
* Returns <0, 0, or >0.
|
|
22
|
+
*/
|
|
23
|
+
export declare function memcmp(s1: Uint8Array | DataView, s1_offset: number, s2: Uint8Array | DataView, s2_offset: number, n: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* C: size_t strlen(const char *s);
|
|
26
|
+
* Returns length of null-terminated string or JS string length.
|
|
27
|
+
*/
|
|
28
|
+
export declare function strlen(s: string): number;
|
|
29
|
+
export declare function read_u8(view: DataView | Uint8Array, offset: number): number;
|
|
30
|
+
export declare function write_u8(view: DataView | Uint8Array, offset: number, val: number): void;
|
|
31
|
+
export declare function read_u16(view: DataView, offset: number): number;
|
|
32
|
+
export declare function write_u16(view: DataView, offset: number, val: number): void;
|
|
33
|
+
export declare function read_u32(view: DataView, offset: number): number;
|
|
34
|
+
export declare function write_u32(view: DataView, offset: number, val: number): void;
|
|
35
|
+
export declare function read_i32(view: DataView, offset: number): number;
|
|
36
|
+
export declare function write_i32(view: DataView, offset: number, val: number): void;
|
|
37
|
+
export declare function read_f64(view: DataView, offset: number): number;
|
|
38
|
+
export declare function write_f64(view: DataView, offset: number, val: number): void;
|
|
39
|
+
export declare function read_u64(view: DataView, offset: number): bigint;
|
|
40
|
+
export declare function write_u64(view: DataView, offset: number, val: bigint): void;
|
|
41
|
+
export declare function read_i64(view: DataView, offset: number): bigint;
|
|
42
|
+
export declare function write_i64(view: DataView, offset: number, val: bigint): void;
|
|
43
|
+
export declare function get_bit(mask: Uint8Array, offset_or_bit: number, bit_idx?: number): number;
|
|
44
|
+
export declare function set_bit(mask: Uint8Array, offset_or_bit: number, bit_idx?: number): void;
|
|
45
|
+
export declare function clear_bit(mask: Uint8Array, offset_or_bit: number, bit_idx?: number): void;
|
|
46
|
+
export declare function c_assert(cond: boolean, msg: string): asserts cond;
|
|
47
|
+
//# sourceMappingURL=c_runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c_runtime.d.ts","sourceRoot":"","sources":["../../src/shared/c_runtime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,UAAU,GAAG,QAAQ,EAC3B,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,UAAU,GAAG,QAAQ,EAC1B,UAAU,EAAE,MAAM,EAClB,CAAC,EAAE,MAAM,GACR,IAAI,CAIN;AAED;;;GAGG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,UAAU,GAAG,QAAQ,EAC3B,WAAW,EAAE,MAAM,EACnB,CAAC,E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
3
|
+
*
|
|
4
|
+
* Provides an abstraction for dynamic page allocation and buffer access
|
|
5
|
+
* during table creation and catalog mutations across Host and Core.
|
|
6
|
+
*/
|
|
7
|
+
export interface IPageProvider {
|
|
8
|
+
allocateNewPage(): number;
|
|
9
|
+
getPageBytes(pageId: number): Uint8Array;
|
|
10
|
+
markPageDirty(pageId: number): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=page_provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page_provider.d.ts","sourceRoot":"","sources":["../../src/shared/page_provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,aAAa;IAC5B,eAAe,IAAI,MAAM,CAAC;IAC1B,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;IACzC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { VmStatus, TableMeta, ColumnMeta } from '../types/index.js';
|
|
2
|
+
export interface VmCursor {
|
|
3
|
+
pageId: number;
|
|
4
|
+
rootPageId?: number;
|
|
5
|
+
slotIdx: number;
|
|
6
|
+
cellIdx: number;
|
|
7
|
+
rowOffset: number;
|
|
8
|
+
btreeDepth?: number;
|
|
9
|
+
flags?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function createVmCursor(): VmCursor;
|
|
12
|
+
export interface VmKeyInfo {
|
|
13
|
+
numKeys: number;
|
|
14
|
+
directions: number[];
|
|
15
|
+
nullOrders: number[];
|
|
16
|
+
limit?: number;
|
|
17
|
+
offset?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface VmSorterEntry {
|
|
20
|
+
keys: any[];
|
|
21
|
+
rowOffset: number;
|
|
22
|
+
rowLen: number;
|
|
23
|
+
rowData?: Uint8Array;
|
|
24
|
+
}
|
|
25
|
+
export interface VmSorter {
|
|
26
|
+
keyInfo: VmKeyInfo;
|
|
27
|
+
entries: VmSorterEntry[];
|
|
28
|
+
readIdx: number;
|
|
29
|
+
isSorted: boolean;
|
|
30
|
+
maxK?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface VmAggBucket {
|
|
33
|
+
hash: number;
|
|
34
|
+
keys: any[];
|
|
35
|
+
count: number;
|
|
36
|
+
sum: number;
|
|
37
|
+
min_val: number;
|
|
38
|
+
max_val: number;
|
|
39
|
+
has_val: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface VmAggregator {
|
|
42
|
+
mode: number;
|
|
43
|
+
startKeyReg: number;
|
|
44
|
+
numKeys: number;
|
|
45
|
+
capacity: number;
|
|
46
|
+
occupiedCount: number;
|
|
47
|
+
readIdx: number;
|
|
48
|
+
buckets: VmAggBucket[];
|
|
49
|
+
}
|
|
50
|
+
export interface VmContext {
|
|
51
|
+
pc: number;
|
|
52
|
+
status: VmStatus;
|
|
53
|
+
fault_page_id: number;
|
|
54
|
+
resultCount: number;
|
|
55
|
+
resultOffset: number;
|
|
56
|
+
arenaOffset: number;
|
|
57
|
+
maxQueryMemory: number;
|
|
58
|
+
rowsAffected: number;
|
|
59
|
+
registers: (number | bigint | string | Uint8Array | null)[];
|
|
60
|
+
cursor: VmCursor;
|
|
61
|
+
cursors: VmCursor[];
|
|
62
|
+
keyInfos: VmKeyInfo[];
|
|
63
|
+
sorters: VmSorter[];
|
|
64
|
+
aggregators: VmAggregator[];
|
|
65
|
+
table: TableMeta | null;
|
|
66
|
+
tables?: TableMeta[];
|
|
67
|
+
outputColumns?: ColumnMeta[];
|
|
68
|
+
udfs?: Record<number, (...args: any[]) => any>;
|
|
69
|
+
inSets?: Set<any>[];
|
|
70
|
+
}
|
|
71
|
+
export declare function createVmContext(): VmContext;
|
|
72
|
+
export declare function resetVmContext(ctx: VmContext, table?: TableMeta, tables?: TableMeta[]): void;
|
|
73
|
+
//# sourceMappingURL=vm_context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vm_context.d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