xitdb 0.12.0 → 0.14.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/README.md +120 -118
- package/dist/core-buffered-file.d.ts +23 -25
- package/dist/core-buffered-file.js +182 -0
- package/dist/core-file.d.ts +8 -10
- package/dist/core-file.js +105 -0
- package/dist/core-memory.d.ts +15 -15
- package/dist/core-memory.js +152 -0
- package/dist/core.d.ts +14 -14
- package/dist/core.js +1 -0
- package/dist/database.d.ts +204 -80
- package/dist/database.js +3047 -0
- package/dist/exceptions.d.ts +4 -0
- package/dist/exceptions.js +62 -0
- package/dist/hasher.d.ts +2 -1
- package/dist/hasher.js +49 -0
- package/dist/index.d.ts +30 -26
- package/dist/index.js +35 -3986
- package/dist/read-array-list.d.ts +8 -8
- package/dist/read-array-list.js +35 -0
- package/dist/read-counted-hash-map.d.ts +3 -3
- package/dist/read-counted-hash-map.js +19 -0
- package/dist/read-counted-hash-set.d.ts +3 -3
- package/dist/read-counted-hash-set.js +19 -0
- package/dist/read-cursor.d.ts +29 -23
- package/dist/read-cursor.js +577 -0
- package/dist/read-hash-map.d.ts +22 -22
- package/dist/read-hash-map.js +65 -0
- package/dist/read-hash-set.d.ts +13 -13
- package/dist/read-hash-set.js +47 -0
- package/dist/read-linked-array-list.d.ts +8 -8
- package/dist/read-linked-array-list.js +35 -0
- package/dist/read-sorted-map.d.ts +21 -0
- package/dist/read-sorted-map.js +73 -0
- package/dist/read-sorted-set.d.ts +19 -0
- package/dist/read-sorted-set.js +65 -0
- package/dist/slot-pointer.d.ts +1 -1
- package/dist/slot-pointer.js +11 -0
- package/dist/slot.d.ts +2 -2
- package/dist/slot.js +41 -0
- package/dist/slotted.d.ts +1 -1
- package/dist/slotted.js +1 -0
- package/dist/tag.d.ts +3 -1
- package/dist/tag.js +25 -0
- package/dist/write-array-list.d.ts +13 -14
- package/dist/write-array-list.js +42 -0
- package/dist/write-counted-hash-map.d.ts +4 -5
- package/dist/write-counted-hash-map.js +18 -0
- package/dist/write-counted-hash-set.d.ts +4 -5
- package/dist/write-counted-hash-set.js +18 -0
- package/dist/write-cursor.d.ts +15 -15
- package/dist/write-cursor.js +124 -0
- package/dist/write-hash-map.d.ts +22 -23
- package/dist/write-hash-map.js +90 -0
- package/dist/write-hash-set.d.ts +16 -17
- package/dist/write-hash-set.js +59 -0
- package/dist/write-linked-array-list.d.ts +16 -17
- package/dist/write-linked-array-list.js +52 -0
- package/dist/write-sorted-map.d.ts +12 -0
- package/dist/write-sorted-map.js +37 -0
- package/dist/write-sorted-set.d.ts +10 -0
- package/dist/write-sorted-set.js +29 -0
- package/dist/writeable-data.js +68 -0
- package/package.json +6 -6
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Slot } from './slot';
|
|
2
|
-
import type { Slotted } from './slotted';
|
|
3
|
-
import { ReadCursor, CursorIterator } from './read-cursor';
|
|
1
|
+
import { Slot } from './slot.js';
|
|
2
|
+
import type { Slotted } from './slotted.js';
|
|
3
|
+
import { ReadCursor, CursorIterator } from './read-cursor.js';
|
|
4
4
|
export declare class ReadArrayList implements Slotted {
|
|
5
5
|
cursor: ReadCursor;
|
|
6
6
|
constructor();
|
|
7
7
|
constructor(cursor: ReadCursor);
|
|
8
8
|
slot(): Slot;
|
|
9
|
-
count():
|
|
10
|
-
iterator():
|
|
11
|
-
[Symbol.
|
|
12
|
-
getCursor(index: number):
|
|
13
|
-
getSlot(index: number):
|
|
9
|
+
count(): number;
|
|
10
|
+
iterator(): CursorIterator;
|
|
11
|
+
[Symbol.iterator](): Iterator<ReadCursor>;
|
|
12
|
+
getCursor(index: number): ReadCursor | null;
|
|
13
|
+
getSlot(index: number): Slot | null;
|
|
14
14
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ArrayListGet } from './database.js';
|
|
2
|
+
import { UnexpectedTagException } from './exceptions.js';
|
|
3
|
+
export class ReadArrayList {
|
|
4
|
+
cursor;
|
|
5
|
+
constructor(cursor) {
|
|
6
|
+
if (cursor) {
|
|
7
|
+
switch (cursor.slotPtr.slot.tag) {
|
|
8
|
+
case 0 /* Tag.NONE */:
|
|
9
|
+
case 2 /* Tag.ARRAY_LIST */:
|
|
10
|
+
this.cursor = cursor;
|
|
11
|
+
break;
|
|
12
|
+
default:
|
|
13
|
+
throw new UnexpectedTagException();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
slot() {
|
|
18
|
+
return this.cursor.slot();
|
|
19
|
+
}
|
|
20
|
+
count() {
|
|
21
|
+
return this.cursor.count();
|
|
22
|
+
}
|
|
23
|
+
iterator() {
|
|
24
|
+
return this.cursor.iterator();
|
|
25
|
+
}
|
|
26
|
+
*[Symbol.iterator]() {
|
|
27
|
+
yield* this.cursor;
|
|
28
|
+
}
|
|
29
|
+
getCursor(index) {
|
|
30
|
+
return this.cursor.readPath([new ArrayListGet(index)]);
|
|
31
|
+
}
|
|
32
|
+
getSlot(index) {
|
|
33
|
+
return this.cursor.readPathSlot([new ArrayListGet(index)]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReadHashMap } from './read-hash-map';
|
|
2
|
-
import { ReadCursor } from './read-cursor';
|
|
1
|
+
import { ReadHashMap } from './read-hash-map.js';
|
|
2
|
+
import { ReadCursor } from './read-cursor.js';
|
|
3
3
|
export declare class ReadCountedHashMap extends ReadHashMap {
|
|
4
4
|
constructor(cursor: ReadCursor);
|
|
5
|
-
count():
|
|
5
|
+
count(): number;
|
|
6
6
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReadHashMap } from './read-hash-map.js';
|
|
2
|
+
import { UnexpectedTagException } from './exceptions.js';
|
|
3
|
+
export class ReadCountedHashMap extends ReadHashMap {
|
|
4
|
+
constructor(cursor) {
|
|
5
|
+
super();
|
|
6
|
+
switch (cursor.slotPtr.slot.tag) {
|
|
7
|
+
case 0 /* Tag.NONE */:
|
|
8
|
+
case 12 /* Tag.COUNTED_HASH_MAP */:
|
|
9
|
+
case 13 /* Tag.COUNTED_HASH_SET */:
|
|
10
|
+
this.cursor = cursor;
|
|
11
|
+
break;
|
|
12
|
+
default:
|
|
13
|
+
throw new UnexpectedTagException();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
count() {
|
|
17
|
+
return this.cursor.count();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReadHashSet } from './read-hash-set';
|
|
2
|
-
import { ReadCursor } from './read-cursor';
|
|
1
|
+
import { ReadHashSet } from './read-hash-set.js';
|
|
2
|
+
import { ReadCursor } from './read-cursor.js';
|
|
3
3
|
export declare class ReadCountedHashSet extends ReadHashSet {
|
|
4
4
|
constructor(cursor: ReadCursor);
|
|
5
|
-
count():
|
|
5
|
+
count(): number;
|
|
6
6
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReadHashSet } from './read-hash-set.js';
|
|
2
|
+
import { UnexpectedTagException } from './exceptions.js';
|
|
3
|
+
export class ReadCountedHashSet extends ReadHashSet {
|
|
4
|
+
constructor(cursor) {
|
|
5
|
+
super();
|
|
6
|
+
switch (cursor.slotPtr.slot.tag) {
|
|
7
|
+
case 0 /* Tag.NONE */:
|
|
8
|
+
case 12 /* Tag.COUNTED_HASH_MAP */:
|
|
9
|
+
case 13 /* Tag.COUNTED_HASH_SET */:
|
|
10
|
+
this.cursor = cursor;
|
|
11
|
+
break;
|
|
12
|
+
default:
|
|
13
|
+
throw new UnexpectedTagException();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
count() {
|
|
17
|
+
return this.cursor.count();
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/read-cursor.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Slot } from './slot';
|
|
2
|
-
import { SlotPointer } from './slot-pointer';
|
|
3
|
-
import type { Slotted } from './slotted';
|
|
4
|
-
import { Database, type PathPart } from './database';
|
|
5
|
-
import { Bytes } from './writeable-data';
|
|
1
|
+
import { Slot } from './slot.js';
|
|
2
|
+
import { SlotPointer } from './slot-pointer.js';
|
|
3
|
+
import type { Slotted } from './slotted.js';
|
|
4
|
+
import { Database, type PathPart } from './database.js';
|
|
5
|
+
import { Bytes } from './writeable-data.js';
|
|
6
6
|
export declare class KeyValuePairCursor {
|
|
7
7
|
valueCursor: ReadCursor;
|
|
8
8
|
keyCursor: ReadCursor;
|
|
@@ -14,18 +14,18 @@ export declare class ReadCursor implements Slotted {
|
|
|
14
14
|
db: Database;
|
|
15
15
|
constructor(slotPtr: SlotPointer, db: Database);
|
|
16
16
|
slot(): Slot;
|
|
17
|
-
readPath(path: PathPart[]):
|
|
18
|
-
readPathSlot(path: PathPart[]):
|
|
17
|
+
readPath(path: PathPart[]): ReadCursor | null;
|
|
18
|
+
readPathSlot(path: PathPart[]): Slot | null;
|
|
19
19
|
readUint(): number;
|
|
20
20
|
readInt(): number;
|
|
21
21
|
readFloat(): number;
|
|
22
|
-
readBytes(maxSizeMaybe?: number | null):
|
|
23
|
-
readBytesObject(maxSizeMaybe?: number | null):
|
|
24
|
-
readKeyValuePair():
|
|
25
|
-
reader():
|
|
26
|
-
count():
|
|
27
|
-
[Symbol.
|
|
28
|
-
iterator():
|
|
22
|
+
readBytes(maxSizeMaybe?: number | null): Uint8Array;
|
|
23
|
+
readBytesObject(maxSizeMaybe?: number | null): Bytes;
|
|
24
|
+
readKeyValuePair(): KeyValuePairCursor;
|
|
25
|
+
reader(): Reader;
|
|
26
|
+
count(): number;
|
|
27
|
+
[Symbol.iterator](): Iterator<ReadCursor>;
|
|
28
|
+
iterator(): CursorIterator;
|
|
29
29
|
}
|
|
30
30
|
export declare class Reader {
|
|
31
31
|
parent: ReadCursor;
|
|
@@ -33,12 +33,12 @@ export declare class Reader {
|
|
|
33
33
|
startPosition: number;
|
|
34
34
|
relativePosition: number;
|
|
35
35
|
constructor(parent: ReadCursor, size: number, startPosition: number, relativePosition: number);
|
|
36
|
-
read(buffer: Uint8Array):
|
|
37
|
-
readFully(buffer: Uint8Array):
|
|
38
|
-
readByte():
|
|
39
|
-
readShort():
|
|
40
|
-
readInt():
|
|
41
|
-
readLong():
|
|
36
|
+
read(buffer: Uint8Array): number;
|
|
37
|
+
readFully(buffer: Uint8Array): void;
|
|
38
|
+
readByte(): number;
|
|
39
|
+
readShort(): number;
|
|
40
|
+
readInt(): number;
|
|
41
|
+
readLong(): number;
|
|
42
42
|
seek(position: number): void;
|
|
43
43
|
}
|
|
44
44
|
export declare class CursorIterator {
|
|
@@ -48,9 +48,15 @@ export declare class CursorIterator {
|
|
|
48
48
|
private stack;
|
|
49
49
|
private nextCursorMaybe;
|
|
50
50
|
constructor(cursor: ReadCursor);
|
|
51
|
-
|
|
51
|
+
static initSortedFromIndex(cursor: ReadCursor, startIndex: number): CursorIterator;
|
|
52
|
+
static initSortedFromKey(cursor: ReadCursor, startKey: Uint8Array): CursorIterator;
|
|
53
|
+
private static sortedRootPtr;
|
|
54
|
+
private static sortedStackFromIndex;
|
|
55
|
+
private static sortedStackFromKey;
|
|
56
|
+
init(): void;
|
|
57
|
+
private readSlotBlock;
|
|
52
58
|
private initStack;
|
|
53
|
-
hasNext():
|
|
54
|
-
next():
|
|
59
|
+
hasNext(): boolean;
|
|
60
|
+
next(): ReadCursor | null;
|
|
55
61
|
private nextInternal;
|
|
56
62
|
}
|