dataply 0.0.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.
@@ -0,0 +1,690 @@
1
+ import { DataPage, IndexPage, BitmapPage, OverflowPage, MetadataPage, EmptyPage, UnknownPage } from '../types';
2
+ import { Row } from './Row';
3
+ /**
4
+ * Manages common methods for each type of page.
5
+ */
6
+ export declare abstract class PageManager {
7
+ static readonly CONSTANT: {
8
+ readonly PAGE_TYPE_UNKNOWN: 0;
9
+ readonly PAGE_TYPE_EMPTY: 1;
10
+ readonly PAGE_TYPE_METADATA: 2;
11
+ readonly PAGE_TYPE_BITMAP: 3;
12
+ readonly PAGE_TYPE_INDEX: 4;
13
+ readonly PAGE_TYPE_DATA: 5;
14
+ readonly PAGE_TYPE_OVERFLOW: 6;
15
+ readonly SIZE_PAGE_HEADER: 100;
16
+ readonly SIZE_PAGE_TYPE: 1;
17
+ readonly SIZE_PAGE_ID: 4;
18
+ readonly SIZE_NEXT_PAGE_ID: 4;
19
+ readonly SIZE_INSERTED_ROW_COUNT: 4;
20
+ readonly SIZE_REMAINING_CAPACITY: 4;
21
+ readonly SIZE_SLOT_OFFSET: 2;
22
+ readonly SIZE_CHECKSUM: 4;
23
+ readonly OFFSET_PAGE_TYPE: 0;
24
+ readonly OFFSET_PAGE_ID: 1;
25
+ readonly OFFSET_NEXT_PAGE_ID: 5;
26
+ readonly OFFSET_INSERTED_ROW_COUNT: 9;
27
+ readonly OFFSET_REMAINING_CAPACITY: 13;
28
+ readonly OFFSET_CHECKSUM: 17;
29
+ };
30
+ /**
31
+ * Returns the page type.
32
+ * @param page Page data
33
+ * @returns Page type
34
+ */
35
+ static GetPageType(page: Uint8Array): number;
36
+ /**
37
+ * Returns the page type.
38
+ * @param page Page data
39
+ * @returns Page type
40
+ */
41
+ getPageType(page: Uint8Array): number;
42
+ /**
43
+ * Returns the page ID.
44
+ * @param page Page data
45
+ * @returns Page ID
46
+ */
47
+ getPageId(page: Uint8Array): number;
48
+ /**
49
+ * Returns the ID of the next connected page.
50
+ * @param page Page data
51
+ * @returns Next connected page ID
52
+ */
53
+ getNextPageId(page: Uint8Array): number;
54
+ /**
55
+ * Returns the remaining capacity of the page.
56
+ * @param page Page data
57
+ * @returns Remaining capacity
58
+ */
59
+ getRemainingCapacity(page: Uint8Array): number;
60
+ /**
61
+ * Returns the checksum of the page.
62
+ * @param page Page data
63
+ * @returns Checksum
64
+ */
65
+ getChecksum(page: Uint8Array): number;
66
+ /**
67
+ * Sets the page type.
68
+ * @param page Page data
69
+ * @param pageType Page type
70
+ */
71
+ setPageType(page: Uint8Array, pageType: number): void;
72
+ /**
73
+ * Sets the page ID.
74
+ * @param page Page data
75
+ * @param pageId Page ID
76
+ */
77
+ setPageId(page: Uint8Array, pageId: number): void;
78
+ /**
79
+ * Sets the ID of the next connected page.
80
+ * @param page Page data
81
+ * @param nextPageId Next connected page ID
82
+ */
83
+ setNextPageId(page: Uint8Array, nextPageId: number): void;
84
+ /**
85
+ * Sets the remaining capacity of the page.
86
+ * @param page Page data
87
+ * @param remainingCapacity Remaining capacity
88
+ */
89
+ setRemainingCapacity(page: Uint8Array, remainingCapacity: number): void;
90
+ /**
91
+ * Sets the checksum of the page.
92
+ * @param page Page data
93
+ * @param checksum Checksum
94
+ */
95
+ setChecksum(page: Uint8Array, checksum: number): void;
96
+ /**
97
+ * Updates the checksum of the page.
98
+ * Calculates the checksum of the page body (excluding the header) and sets it in the header.
99
+ * @param page Page data
100
+ */
101
+ updateChecksum(page: Uint8Array): void;
102
+ /**
103
+ * Verifies the checksum of the page.
104
+ * Calculates the checksum of the page body and compares it with the checksum stored in the header.
105
+ * @param page Page data
106
+ * @returns boolean indicating if the checksum is valid
107
+ */
108
+ verifyChecksum(page: Uint8Array): boolean;
109
+ /**
110
+ * Sets the page header.
111
+ * @param page Page data
112
+ * @param header Page header
113
+ */
114
+ setHeader(page: Uint8Array, header: Uint8Array): void;
115
+ /**
116
+ * Sets the page body.
117
+ * @param page Page data
118
+ * @param body Page body
119
+ */
120
+ setBody(page: Uint8Array, body: Uint8Array): void;
121
+ /**
122
+ * Initializes the page.
123
+ * @param page Page data
124
+ * @param pageType Page type
125
+ * @param pageId Page ID
126
+ * @param nextPageId Next connected page ID
127
+ * @param remainingCapacity Remaining capacity
128
+ */
129
+ initial(page: Uint8Array, pageType: number, pageId: number, nextPageId: number, remainingCapacity: number): void;
130
+ /**
131
+ * Returns the body of the page.
132
+ * @param page Page data
133
+ * @returns Page body
134
+ */
135
+ getBody(page: Uint8Array): Uint8Array;
136
+ /**
137
+ * Returns the page type.
138
+ */
139
+ abstract get pageType(): number;
140
+ /**
141
+ * Creates a new page.
142
+ * @param pageSize Page size
143
+ * @param pageId Page ID
144
+ * @returns Created page data
145
+ */
146
+ create(pageSize: number, pageId: number): Uint8Array;
147
+ }
148
+ /**
149
+ * Represents that a page is empty.
150
+ */
151
+ export declare class EmptyPageManager extends PageManager {
152
+ get pageType(): 1;
153
+ /**
154
+ * Checks if the page type is `EmptyPage`.
155
+ * @param page Page data
156
+ * @returns boolean indicating if the page type is `EmptyPage`
157
+ */
158
+ static IsEmptyPage(page: Uint8Array): page is EmptyPage;
159
+ /**
160
+ * Checks if the page type is `EmptyPage`.
161
+ * @param page Page data
162
+ * @returns boolean indicating if the page type is `EmptyPage`
163
+ */
164
+ isEmptyPage(page: Uint8Array): page is EmptyPage;
165
+ }
166
+ /**
167
+ * Represents a data page.
168
+ * A data page is where actual data is stored.
169
+ * Rows are stored in data pages. The position where a row is stored is determined by the slot offset.
170
+ * Slot offsets occupy 2 bytes each starting from the end of the page.
171
+ *
172
+ * If the row size is larger than the remaining capacity of the page, a new page is created and used.
173
+ * If the row size is larger than the page size itself, it is stored in an overflow page.
174
+ * In this case, the row has its overflow flag set in the header, and the body stores the ID of the overflow page.
175
+ */
176
+ export declare class DataPageManager extends PageManager {
177
+ get pageType(): 5;
178
+ protected readonly row: Row;
179
+ /**
180
+ * Checks if the page type is `DataPage`.
181
+ * @param page Page data
182
+ * @returns boolean indicating if the page type is `DataPage`
183
+ */
184
+ static IsDataPage(page: Uint8Array): page is DataPage;
185
+ /**
186
+ * Checks if the page type is `DataPage`.
187
+ * @param page Page data
188
+ * @returns boolean indicating if the page type is `DataPage`
189
+ */
190
+ isDataPage(page: Uint8Array): page is DataPage;
191
+ /**
192
+ * Returns the offset of a row within the page.
193
+ * @param page Page data
194
+ * @param slotIndex Slot index
195
+ * @returns Row offset within the page
196
+ */
197
+ getRowOffset(page: DataPage, slotIndex: number): number;
198
+ /**
199
+ * Returns the row from the page.
200
+ * @param page Page data
201
+ * @param slotIndex Slot index
202
+ * @returns Row data within the page
203
+ */
204
+ getRow(page: DataPage, slotIndex: number): Uint8Array;
205
+ /**
206
+ * Returns the number of rows inserted into the page.
207
+ * @param page Page data
208
+ * @returns Number of rows inserted
209
+ */
210
+ getInsertedRowCount(page: Uint8Array): number;
211
+ /**
212
+ * Sets the offset of a row within the page.
213
+ * @param page Page data
214
+ * @param slotIndex Slot index
215
+ * @param offset Row offset within the page
216
+ */
217
+ setRowOffset(page: DataPage, slotIndex: number, offset: number): void;
218
+ /**
219
+ * Sets the number of rows inserted into the page.
220
+ * @param page Page data
221
+ * @param insertedRowCount Number of rows inserted
222
+ */
223
+ setInsertedRowCount(page: Uint8Array, insertedRowCount: number): void;
224
+ /**
225
+ * Calculates if there is space for a row in the page and determines insertability.
226
+ * If insertable, returns the slot index to be inserted.
227
+ * If not, returns -1.
228
+ * @param page Page data
229
+ * @param row Row data
230
+ * @returns Slot index for the row
231
+ */
232
+ getNextSlotIndex(page: DataPage, row: Uint8Array): number;
233
+ /**
234
+ * Returns the position for the next row to be inserted.
235
+ * @param page Page data
236
+ * @returns Next insert position
237
+ */
238
+ getNextInsertPosition(page: DataPage): number;
239
+ /**
240
+ * Inserts a row into the page. `getNextSlotIndex` should be called beforehand to verify availability.
241
+ * @param page Page data
242
+ * @param row Row data
243
+ */
244
+ insert(page: DataPage, row: Uint8Array): void;
245
+ }
246
+ /**
247
+ * Represents an index page.
248
+ * An index page is used to store page indices.
249
+ */
250
+ export declare class IndexPageManager extends PageManager {
251
+ get pageType(): 4;
252
+ static readonly CONSTANT: {
253
+ readonly OFFSET_INDEX_ID: 100;
254
+ readonly OFFSET_PARENT_INDEX_ID: 104;
255
+ readonly OFFSET_NEXT_INDEX_ID: 108;
256
+ readonly OFFSET_PREV_INDEX_ID: 112;
257
+ readonly OFFSET_IS_LEAF: 116;
258
+ readonly OFFSET_KEYS_COUNT: 117;
259
+ readonly OFFSET_VALUES_COUNT: 121;
260
+ readonly OFFSET_KEYS_AND_VALUES: 128;
261
+ readonly SIZE_INDEX_ID: 4;
262
+ readonly SIZE_PARENT_INDEX_ID: 4;
263
+ readonly SIZE_NEXT_INDEX_ID: 4;
264
+ readonly SIZE_PREV_INDEX_ID: 4;
265
+ readonly SIZE_IS_LEAF: 1;
266
+ readonly SIZE_KEYS_COUNT: 4;
267
+ readonly SIZE_VALUES_COUNT: 4;
268
+ readonly SIZE_KEY: 8;
269
+ readonly SIZE_VALUE: 8;
270
+ readonly PAGE_TYPE_UNKNOWN: 0;
271
+ readonly PAGE_TYPE_EMPTY: 1;
272
+ readonly PAGE_TYPE_METADATA: 2;
273
+ readonly PAGE_TYPE_BITMAP: 3;
274
+ readonly PAGE_TYPE_INDEX: 4;
275
+ readonly PAGE_TYPE_DATA: 5;
276
+ readonly PAGE_TYPE_OVERFLOW: 6;
277
+ readonly SIZE_PAGE_HEADER: 100;
278
+ readonly SIZE_PAGE_TYPE: 1;
279
+ readonly SIZE_PAGE_ID: 4;
280
+ readonly SIZE_NEXT_PAGE_ID: 4;
281
+ readonly SIZE_INSERTED_ROW_COUNT: 4;
282
+ readonly SIZE_REMAINING_CAPACITY: 4;
283
+ readonly SIZE_SLOT_OFFSET: 2;
284
+ readonly SIZE_CHECKSUM: 4;
285
+ readonly OFFSET_PAGE_TYPE: 0;
286
+ readonly OFFSET_PAGE_ID: 1;
287
+ readonly OFFSET_NEXT_PAGE_ID: 5;
288
+ readonly OFFSET_INSERTED_ROW_COUNT: 9;
289
+ readonly OFFSET_REMAINING_CAPACITY: 13;
290
+ readonly OFFSET_CHECKSUM: 17;
291
+ };
292
+ /**
293
+ * Checks if the page type is `IndexPage`.
294
+ * @param page Page data
295
+ * @returns boolean indicating if the page type is `IndexPage`
296
+ */
297
+ static IsIndexPage(page: Uint8Array): page is IndexPage;
298
+ /**
299
+ * Checks if the page type is `IndexPage`.
300
+ * @param page Page data
301
+ * @returns boolean indicating if the page type is `IndexPage`
302
+ */
303
+ isIndexPage(page: Uint8Array): page is IndexPage;
304
+ /**
305
+ * Gets the index ID of the page.
306
+ * @param page Page data
307
+ * @returns Index ID
308
+ */
309
+ getIndexId(page: Uint8Array): number;
310
+ /**
311
+ * Gets the parent index ID of the page.
312
+ * @param page Page data
313
+ * @returns Parent index ID
314
+ */
315
+ getParentIndexId(page: Uint8Array): number;
316
+ /**
317
+ * Gets the next index ID of the page.
318
+ * @param page Page data
319
+ * @returns Next index ID
320
+ */
321
+ getNextIndexId(page: Uint8Array): number;
322
+ /**
323
+ * Gets the previous index ID of the page.
324
+ * @param page Page data
325
+ * @returns Previous index ID
326
+ */
327
+ getPrevIndexId(page: Uint8Array): number;
328
+ /**
329
+ * Gets the is leaf of the page.
330
+ * @param page Page data
331
+ * @returns Is leaf
332
+ */
333
+ getIsLeaf(page: Uint8Array): boolean;
334
+ /**
335
+ * Gets the keys count of the page.
336
+ * @param page Page data
337
+ * @returns Keys count
338
+ */
339
+ getKeysCount(page: Uint8Array): number;
340
+ /**
341
+ * Gets the values count of the page.
342
+ * @param page Page data
343
+ * @returns Values count
344
+ */
345
+ getValuesCount(page: Uint8Array): number;
346
+ /**
347
+ * Sets the index ID of the page.
348
+ * @param page Page data
349
+ * @param indexId Index ID
350
+ */
351
+ setIndexId(page: Uint8Array, indexId: number): void;
352
+ /**
353
+ * Sets the parent index ID of the page.
354
+ * @param page Page data
355
+ * @param parentIndexId Parent index ID
356
+ */
357
+ setParentIndexId(page: Uint8Array, parentIndexId: number): void;
358
+ /**
359
+ * Sets the next index ID of the page.
360
+ * @param page Page data
361
+ * @param nextIndexId Next index ID
362
+ */
363
+ setNextIndexId(page: Uint8Array, nextIndexId: number): void;
364
+ /**
365
+ * Sets the previous index ID of the page.
366
+ * @param page Page data
367
+ * @param prevIndexId Previous index ID
368
+ */
369
+ setPrevIndexId(page: Uint8Array, prevIndexId: number): void;
370
+ /**
371
+ * Sets the is leaf of the page.
372
+ * @param page Page data
373
+ * @param isLeaf Is leaf
374
+ */
375
+ setIsLeaf(page: Uint8Array, isLeaf: boolean): void;
376
+ /**
377
+ * Sets the keys count of the page.
378
+ * @param page Page data
379
+ * @param keysCount Keys count
380
+ */
381
+ setKeysCount(page: Uint8Array, keysCount: number): void;
382
+ /**
383
+ * Sets the values count of the page.
384
+ * @param page Page data
385
+ * @param valuesCount Values count
386
+ */
387
+ setValuesCount(page: Uint8Array, valuesCount: number): void;
388
+ /**
389
+ * Gets the keys of the page.
390
+ * @param page Page data
391
+ * @returns Keys
392
+ */
393
+ getKeys(page: Uint8Array): number[];
394
+ /**
395
+ * Gets the values of the page.
396
+ * @param page Page data
397
+ * @returns Values
398
+ */
399
+ getValues(page: Uint8Array): number[];
400
+ /**
401
+ * Sets the keys and values of the page.
402
+ * @param page Page data
403
+ * @param keys Keys
404
+ * @param values Values
405
+ */
406
+ setKeysAndValues(page: Uint8Array, keys: number[], values: number[]): void;
407
+ }
408
+ /**
409
+ * Represents a metadata page.
410
+ * A metadata page stores database metadata.
411
+ */
412
+ export declare class MetadataPageManager extends PageManager {
413
+ get pageType(): 2;
414
+ static readonly CONSTANT: {
415
+ readonly MAGIC_STRING: "DATAPLY";
416
+ readonly OFFSET_MAGIC_STRING: 100;
417
+ readonly OFFSET_PAGE_COUNT: 108;
418
+ readonly OFFSET_PAGE_SIZE: 112;
419
+ readonly OFFSET_ROW_COUNT: 116;
420
+ readonly OFFSET_ROOT_INDEX_PAGE_ID: 122;
421
+ readonly OFFSET_ROOT_INDEX_ORDER: 126;
422
+ readonly OFFSET_LAST_INSERT_PAGE_ID: 130;
423
+ readonly OFFSET_LAST_ROW_PK: 134;
424
+ readonly SIZE_PAGE_COUNT: 4;
425
+ readonly SIZE_PAGE_SIZE: 4;
426
+ readonly SIZE_ROOT_INDEX_PAGE_ID: 4;
427
+ readonly SIZE_ROOT_INDEX_ORDER: 4;
428
+ readonly SIZE_LAST_INSERT_PAGE_ID: 4;
429
+ readonly PAGE_TYPE_UNKNOWN: 0;
430
+ readonly PAGE_TYPE_EMPTY: 1;
431
+ readonly PAGE_TYPE_METADATA: 2;
432
+ readonly PAGE_TYPE_BITMAP: 3;
433
+ readonly PAGE_TYPE_INDEX: 4;
434
+ readonly PAGE_TYPE_DATA: 5;
435
+ readonly PAGE_TYPE_OVERFLOW: 6;
436
+ readonly SIZE_PAGE_HEADER: 100;
437
+ readonly SIZE_PAGE_TYPE: 1;
438
+ readonly SIZE_PAGE_ID: 4;
439
+ readonly SIZE_NEXT_PAGE_ID: 4;
440
+ readonly SIZE_INSERTED_ROW_COUNT: 4;
441
+ readonly SIZE_REMAINING_CAPACITY: 4;
442
+ readonly SIZE_SLOT_OFFSET: 2;
443
+ readonly SIZE_CHECKSUM: 4;
444
+ readonly OFFSET_PAGE_TYPE: 0;
445
+ readonly OFFSET_PAGE_ID: 1;
446
+ readonly OFFSET_NEXT_PAGE_ID: 5;
447
+ readonly OFFSET_INSERTED_ROW_COUNT: 9;
448
+ readonly OFFSET_REMAINING_CAPACITY: 13;
449
+ readonly OFFSET_CHECKSUM: 17;
450
+ };
451
+ /**
452
+ * Checks if the page type is `MetadataPage`.
453
+ * @param page Page data
454
+ * @returns boolean indicating if the page type is `MetadataPage`
455
+ */
456
+ static IsMetadataPage(page: Uint8Array): page is MetadataPage;
457
+ /**
458
+ * Checks if the page type is `MetadataPage`.
459
+ * @param page Page data
460
+ * @returns boolean indicating if the page type is `MetadataPage`
461
+ */
462
+ isMetadataPage(page: Uint8Array): page is MetadataPage;
463
+ /**
464
+ * Verifies if the page is a valid metadata page.
465
+ * @param page Page data
466
+ * @returns Whether it is a metadata page
467
+ */
468
+ static Verify(page: MetadataPage): boolean;
469
+ /**
470
+ * Returns the number of pages stored in the database.
471
+ * @param page Page data
472
+ * @returns Number of pages
473
+ */
474
+ getPageCount(page: MetadataPage): number;
475
+ /**
476
+ * Returns the database page size.
477
+ * @param page Page data
478
+ * @returns Page size
479
+ */
480
+ getPageSize(page: MetadataPage): number;
481
+ /**
482
+ * Returns the Root Index Page ID of the database.
483
+ * @param page Page data
484
+ * @returns Root Index Page ID
485
+ */
486
+ getRootIndexPageId(page: MetadataPage): number;
487
+ /**
488
+ * Returns the order of the database Root Index Page.
489
+ * @param page Page data
490
+ * @returns Root Index Page order
491
+ */
492
+ getRootIndexOrder(page: MetadataPage): number;
493
+ /**
494
+ * Returns the ID of the last insertion page.
495
+ * @param page Page data
496
+ * @returns Last insert page ID
497
+ */
498
+ getLastInsertPageId(page: MetadataPage): number;
499
+ /**
500
+ * Returns the PK of the last inserted row in the database.
501
+ * @param page Page data
502
+ * @returns Last inserted row PK
503
+ */
504
+ getLastRowPk(page: MetadataPage): number;
505
+ /**
506
+ * Returns the number of rows in the database.
507
+ * @param page Page data
508
+ * @returns Number of rows
509
+ */
510
+ getRowCount(page: MetadataPage): number;
511
+ /**
512
+ * Sets the number of pages stored in the database.
513
+ * @param page Page data
514
+ * @param pageCount Number of pages
515
+ */
516
+ setPageCount(page: MetadataPage, pageCount: number): void;
517
+ /**
518
+ * Sets the database page size.
519
+ * @param page Page data
520
+ * @param pageSize Page size
521
+ */
522
+ setPageSize(page: MetadataPage, pageSize: number): void;
523
+ /**
524
+ * Sets the Root Index Page ID of the database.
525
+ * @param page Page data
526
+ * @param rootIndexPageId Root Index Page ID
527
+ */
528
+ setRootIndexPageId(page: MetadataPage, rootIndexPageId: number): void;
529
+ /**
530
+ * Sets the order of the database Root Index Page.
531
+ * @param page Page data
532
+ * @param order Root Index Page order
533
+ */
534
+ setRootIndexOrder(page: MetadataPage, order: number): void;
535
+ /**
536
+ * Sets the magic string of the page.
537
+ * @param page Page data
538
+ */
539
+ setMagicString(page: MetadataPage): void;
540
+ /**
541
+ * Sets the ID of the last insertion page.
542
+ * @param page Page data
543
+ * @param lastInsertPageId Last insert page ID
544
+ */
545
+ setLastInsertPageId(page: MetadataPage, lastInsertPageId: number): void;
546
+ /**
547
+ * Sets the PK of the last inserted row in the database.
548
+ * @param page Page data
549
+ * @param lastRowPk Last inserted row PK
550
+ */
551
+ setLastRowPk(page: MetadataPage, lastRowPk: number): void;
552
+ /**
553
+ * Sets the number of rows in the database.
554
+ * @param page Page data
555
+ * @param rowCount Number of rows
556
+ */
557
+ setRowCount(page: MetadataPage, rowCount: number): void;
558
+ }
559
+ /**
560
+ * Represents a bitmap page.
561
+ * A bitmap page stores a bitmap of pages.
562
+ */
563
+ export declare class BitmapPageManager extends PageManager {
564
+ get pageType(): 3;
565
+ /**
566
+ * Checks if the page type is `BitmapPage`.
567
+ * @param page Page data
568
+ * @returns boolean indicating if the page type is `BitmapPage`
569
+ */
570
+ static IsBitmapPage(page: Uint8Array): page is BitmapPage;
571
+ /**
572
+ * Checks if the page type is `BitmapPage`.
573
+ * @param page Page data
574
+ * @returns boolean indicating if the page type is `BitmapPage`
575
+ */
576
+ isBitmapPage(page: Uint8Array): page is BitmapPage;
577
+ /**
578
+ * Checks if a page is empty.
579
+ * @param page Page data
580
+ * @param index Bitmap index
581
+ * @returns boolean indicating if the page is empty
582
+ */
583
+ isEmptyPage(page: BitmapPage, index: number): boolean;
584
+ }
585
+ /**
586
+ * Represents an overflow page.
587
+ * An overflow page stores overflow data of pages.
588
+ * Overflow pages store data of rows in data pages where the overflow flag is set.
589
+ */
590
+ export declare class OverflowPageManager extends PageManager {
591
+ get pageType(): 6;
592
+ /**
593
+ * Checks if the page type is `OverflowPage`.
594
+ * @param page Page data
595
+ * @returns boolean indicating if the page type is `OverflowPage`
596
+ */
597
+ static IsOverflowPage(page: Uint8Array): page is OverflowPage;
598
+ /**
599
+ * Checks if the page type is `OverflowPage`.
600
+ * @param page Page data
601
+ * @returns boolean indicating if the page type is `OverflowPage`
602
+ */
603
+ isOverflowPage(page: Uint8Array): page is OverflowPage;
604
+ }
605
+ export declare class UnknownPageManager extends PageManager {
606
+ get pageType(): 0;
607
+ /**
608
+ * Checks if the page type is `UnknownPage`.
609
+ * @param page Page data
610
+ * @returns boolean indicating if the page type is `UnknownPage`
611
+ */
612
+ static IsUnknownPage(page: Uint8Array): page is UnknownPage;
613
+ /**
614
+ * Checks if the page is `UnknownPage`.
615
+ * @param page Page data
616
+ * @returns `true` if the page is `UnknownPage`, otherwise `false`
617
+ */
618
+ isUnknownPage(page: Uint8Array): page is UnknownPage;
619
+ }
620
+ export declare class PageManagerFactory {
621
+ protected static readonly EmptyPage: EmptyPageManager;
622
+ protected static readonly DataPage: DataPageManager;
623
+ protected static readonly IndexPage: IndexPageManager;
624
+ protected static readonly MetadataPage: MetadataPageManager;
625
+ protected static readonly BitmapPage: BitmapPageManager;
626
+ protected static readonly OverflowPage: OverflowPageManager;
627
+ protected static readonly UnknownPage: UnknownPageManager;
628
+ /**
629
+ * Returns the page type.
630
+ * @param page Page data
631
+ * @returns Page type
632
+ */
633
+ protected getPageType(page: Uint8Array): number;
634
+ /**
635
+ * Checks if the page is `EmptyPage`.
636
+ * @param page Page data
637
+ * @returns `true` if the page is `EmptyPage`, otherwise `false`
638
+ */
639
+ isEmptyPage(page: Uint8Array): page is EmptyPage;
640
+ /**
641
+ * Checks if the page is `DataPage`.
642
+ * @param page Page data
643
+ * @returns `true` if the page is `DataPage`, otherwise `false`
644
+ */
645
+ isDataPage(page: Uint8Array): page is DataPage;
646
+ /**
647
+ * Checks if the page is `IndexPage`.
648
+ * @param page Page data
649
+ * @returns `true` if the page is `IndexPage`, otherwise `false`
650
+ */
651
+ isIndexPage(page: Uint8Array): page is IndexPage;
652
+ /**
653
+ * Checks if the page is `MetadataPage`.
654
+ * @param page Page data
655
+ * @returns `true` if the page is `MetadataPage`, otherwise `false`
656
+ */
657
+ isMetadataPage(page: Uint8Array): page is MetadataPage;
658
+ /**
659
+ * Checks if the page is `BitmapPage`.
660
+ * @param page Page data
661
+ * @returns `true` if the page is `BitmapPage`, otherwise `false`
662
+ */
663
+ isBitmapPage(page: Uint8Array): page is BitmapPage;
664
+ /**
665
+ * Checks if the page is `OverflowPage`.
666
+ * @param page Page data
667
+ * @returns `true` if the page is `OverflowPage`, otherwise `false`
668
+ */
669
+ isOverflowPage(page: Uint8Array): page is OverflowPage;
670
+ /**
671
+ * Checks if the page is `UnknownPage`.
672
+ * @param page Page data
673
+ * @returns `true` if the page is `UnknownPage`, otherwise `false`
674
+ */
675
+ isUnknownPage(page: Uint8Array): page is UnknownPage;
676
+ /**
677
+ * Returns a page manager based on the page type.
678
+ * @param page Page data
679
+ * @returns Page manager
680
+ */
681
+ getManager(page: EmptyPage): EmptyPageManager;
682
+ getManager(page: MetadataPage): MetadataPageManager;
683
+ getManager(page: IndexPage): IndexPageManager;
684
+ getManager(page: DataPage): DataPageManager;
685
+ getManager(page: BitmapPage): BitmapPageManager;
686
+ getManager(page: OverflowPage): OverflowPageManager;
687
+ getManager(page: UnknownPage): UnknownPageManager;
688
+ getManager(page: Uint8Array): PageManager;
689
+ getManagerFromType(pageType: number): PageManager;
690
+ }