xitdb 0.4.0 → 0.6.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 CHANGED
@@ -37,7 +37,7 @@ const db = await Database.create(core, hasher);
37
37
 
38
38
  // to get the benefits of immutability, the top-level data structure
39
39
  // must be an ArrayList, so each transaction is stored as an item in it
40
- const history = await WriteArrayList.create(await db.rootCursor());
40
+ const history = await WriteArrayList.create(db.rootCursor());
41
41
 
42
42
  // this is how a transaction is executed. we call history.appendContext,
43
43
  // providing it with the most recent copy of the db and a context
@@ -320,13 +320,11 @@ All data structures support iteration. Here's an example of iterating over an `A
320
320
  const peopleCursor = await moment.getCursorByString('people');
321
321
  const people = new ReadArrayList(peopleCursor!);
322
322
 
323
- const peopleIter = people.iterator();
324
- await peopleIter.init();
323
+ const peopleIter = await people.iterator();
325
324
  while (await peopleIter.hasNext()) {
326
325
  const personCursor = await peopleIter.next();
327
326
  const person = await ReadHashMap.create(personCursor!);
328
- const personIter = person.iterator();
329
- await personIter.init();
327
+ const personIter = await person.iterator();
330
328
  while (await personIter.hasNext()) {
331
329
  const kvPairCursor = await personIter.next();
332
330
  const kvPair = await kvPairCursor!.readKeyValuePair();
@@ -4,6 +4,7 @@ import { Tag } from './tag';
4
4
  import { Slot } from './slot';
5
5
  import { SlotPointer } from './slot-pointer';
6
6
  import { type WriteableData } from './writeable-data';
7
+ import { WriteCursor } from './write-cursor';
7
8
  export declare const VERSION = 0;
8
9
  export declare const MAGIC_NUMBER: Uint8Array<ArrayBuffer>;
9
10
  export declare const BIT_COUNT = 4;
@@ -220,7 +221,7 @@ export declare class Database {
220
221
  txStart: number | null;
221
222
  private constructor();
222
223
  static create(core: Core, hasher: Hasher): Promise<Database>;
223
- rootCursor(): Promise<any>;
224
+ rootCursor(): WriteCursor;
224
225
  freeze(): Promise<void>;
225
226
  truncate(): Promise<void>;
226
227
  checkHashBytes(hash: Uint8Array): Uint8Array;