You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add `snapshot` to TypeScript option types
- Remove redundant documentation from README
- Don't mark explicit snapshots as experimental. I'm confident in this
feature now (having finished the implementation in `classic-level`)
and I'm happy with the API.
Ref: Level/community#118
Follow-Up-To: #93
Copy file name to clipboardExpand all lines: README.md
+7-11
Original file line number
Diff line number
Diff line change
@@ -154,7 +154,7 @@ Get a value from the database by `key`. The optional `options` object may contai
154
154
155
155
-`keyEncoding`: custom key encoding for this operation, used to encode the `key`.
156
156
-`valueEncoding`: custom value encoding for this operation, used to decode the value.
157
-
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions) to read from. If no `snapshot` is provided and `db.supports.implicitSnapshots` is true, the database will create its own internal snapshot for this operation.
157
+
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions) to read from.
158
158
159
159
Returns a promise for the value. If the `key` was not found then the value will be `undefined`.
160
160
@@ -164,7 +164,7 @@ Get multiple values from the database by an array of `keys`. The optional `optio
164
164
165
165
-`keyEncoding`: custom key encoding for this operation, used to encode the `keys`.
166
166
-`valueEncoding`: custom value encoding for this operation, used to decode values.
167
-
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions) to read from. If no `snapshot` is provided and `db.supports.implicitSnapshots` is true, the database will create its own internal snapshot for this operation.
167
+
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions) to read from.
168
168
169
169
Returns a promise for an array of values with the same order as `keys`. If a key was not found, the relevant value will be `undefined`.
170
170
@@ -173,7 +173,7 @@ Returns a promise for an array of values with the same order as `keys`. If a key
173
173
Check if the database has an entry with the given `key`. The optional `options` object may contain:
174
174
175
175
-`keyEncoding`: custom key encoding for this operation, used to encode the `key`.
176
-
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions) to read from. If no `snapshot` is provided and `db.supports.implicitSnapshots` is true, the database will create its own internal snapshot for this operation.
176
+
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions) to read from.
177
177
178
178
Returns a promise for a boolean. For example:
179
179
@@ -198,7 +198,7 @@ if (value !== undefined) {
198
198
Check if the database has entries with the given keys. The `keys` argument must be an array. The optional `options` object may contain:
199
199
200
200
-`keyEncoding`: custom key encoding for this operation, used to encode the `keys`.
201
-
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions) to read from. If no `snapshot` is provided and `db.supports.implicitSnapshots` is true, the database will create its own internal snapshot for this operation.
201
+
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions) to read from.
202
202
203
203
Returns a promise for an array of booleans with the same order as `keys`. For example:
204
204
@@ -299,7 +299,7 @@ The `gte` and `lte` range options take precedence over `gt` and `lt` respectivel
299
299
-`keyEncoding`: custom key encoding for this iterator, used to encode range options, to encode `seek()` targets and to decode keys.
300
300
-`valueEncoding`: custom value encoding for this iterator, used to decode values.
301
301
-`signal`: an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to [abort read operations on the iterator](#aborting-iterators).
302
-
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions)for the iterator to read from. If no `snapshot` is provided and `db.supports.implicitSnapshots` is true, the database will create its own internal snapshot before returning an iterator.
302
+
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions) to read from.
303
303
304
304
Lastly, an implementation is free to add its own options.
305
305
@@ -342,7 +342,7 @@ Delete all entries or a range. Not guaranteed to be atomic. Returns a promise. A
342
342
-`reverse` (boolean, default: `false`): delete entries in reverse order. Only effective in combination with `limit`, to delete the last N entries.
343
343
-`limit` (number, default: `Infinity`): limit the number of entries to be deleted. This number represents a _maximum_ number of entries and will not be reached if the end of the range is reached first. A value of `Infinity` or `-1` means there is no limit. When `reverse` is true the entries with the highest keys will be deleted instead of the lowest keys.
344
344
-`keyEncoding`: custom key encoding for this operation, used to encode range options.
345
-
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions) to read from, such that entries not present in the snapshot will not be deleted. If no `snapshot` is provided and `db.supports.implicitSnapshots` is true, the database may create its own internal snapshot but (unlike on other methods) this is currently not a hard requirement for implementations.
345
+
-`snapshot`: explicit [snapshot](#snapshot--dbsnapshotoptions) to read from, such that entries not present in the snapshot will not be deleted. If no `snapshot` is provided, the database may create its own internal snapshot but (unlike on other methods) this is currently not a hard requirement for implementations.
346
346
347
347
The `gte` and `lte` range options take precedence over `gt` and `lt` respectively. If no options are provided, all entries will be deleted.
**This is an experimental API ([Level/community#118](https://github.com/Level/community/issues/118)).**
455
-
456
-
Create an explicit [snapshot](#snapshot). Throws a [`LEVEL_NOT_SUPPORTED`](#level_not_supported) error if `db.supports.explicitSnapshots` is false. For details, see [Reading From Snapshots](#reading-from-snapshots).
454
+
Create an explicit [snapshot](#snapshot). Throws a [`LEVEL_NOT_SUPPORTED`](#level_not_supported) error if `db.supports.explicitSnapshots` is false ([Level/community#118](https://github.com/Level/community/issues/118)). For details, see [Reading From Snapshots](#reading-from-snapshots).
457
455
458
456
There are currently no options but specific implementations may add their own.
459
457
460
-
Don't forget to call `snapshot.close()` when done.
461
-
462
458
### `db.supports`
463
459
464
460
A [manifest](https://github.com/Level/supports) describing the features supported by this database. Might be used like so:
0 commit comments