@peerbit/lazy-level
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -20,2 +20,8 @@ import { AbstractBatchOperation, AbstractLevel } from "abstract-level"; | ||
sublevel(name: string): MaybePromise<SimpleLevel>; | ||
iterator: () => { | ||
[Symbol.asyncIterator]: () => AsyncIterator<[ | ||
string, | ||
Uint8Array | ||
], void, void>; | ||
}; | ||
clear(): Promise<void>; | ||
@@ -55,2 +61,3 @@ idle?(): Promise<void>; | ||
getByPrefix(prefix: string): Promise<Uint8Array[]>; | ||
iterator(): AsyncGenerator<[string, Uint8Array], void, void>; | ||
clear(clearStore?: boolean): Promise<void>; | ||
@@ -57,0 +64,0 @@ deleteByPrefix(prefix: string): Promise<void>; |
@@ -216,2 +216,10 @@ import { logger as loggerFn } from "@peerbit/logger"; | ||
} | ||
async *iterator() { | ||
const iterator = this._store.iterator({ | ||
valueEncoding: "view" | ||
}); | ||
for await (const [key, value] of iterator) { | ||
yield [key, value]; | ||
} | ||
} | ||
async clear(clearStore = true) { | ||
@@ -218,0 +226,0 @@ this.txQueue?.clear(); |
{ | ||
"name": "@peerbit/lazy-level", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Level with lazy transactions", | ||
@@ -45,3 +45,3 @@ "type": "module", | ||
], | ||
"gitHead": "6442481a66eec1bc13d06b3663f93643c247d141" | ||
"gitHead": "b1e1a717e7c7aae00909c2fcb0944efa54f4523c" | ||
} |
@@ -25,2 +25,9 @@ import { logger as loggerFn } from "@peerbit/logger"; | ||
sublevel(name: string): MaybePromise<SimpleLevel>; | ||
iterator: () => { | ||
[Symbol.asyncIterator]: () => AsyncIterator< | ||
[string, Uint8Array], | ||
void, | ||
void | ||
>; | ||
}; | ||
clear(): Promise<void>; | ||
@@ -279,2 +286,11 @@ idle?(): Promise<void>; | ||
async *iterator(): AsyncGenerator<[string, Uint8Array], void, void> { | ||
const iterator = this._store.iterator<any, Uint8Array>({ | ||
valueEncoding: "view" | ||
}); | ||
for await (const [key, value] of iterator) { | ||
yield [key, value]; | ||
} | ||
} | ||
async clear(clearStore = true): Promise<void> { | ||
@@ -281,0 +297,0 @@ this.txQueue?.clear(); |
Sorry, the diff of this file is not supported yet
33381
705