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
Copy file name to clipboardExpand all lines: README.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -597,8 +597,6 @@ The optional `options` object may contain:
597
597
598
598
If range options like `gt` were passed to `db.iterator()` and `target` does not fall within that range, the iterator will reach its natural end.
599
599
600
-
**Note:** Not all implementations support `seek()`. Consult `db.supports.seek` or the [support matrix](https://github.com/Level/supports#seek-boolean).
601
-
602
600
#### `iterator.close()`
603
601
604
602
Free up underlying resources. Returns a promise. Closing the iterator is an idempotent operation, such that calling `close()` more than once is allowed and makes no difference.
@@ -1349,14 +1347,14 @@ When a sublevel prefix contains characters outside of the supported byte range.
1349
1347
1350
1348
#### `LEVEL_NOT_SUPPORTED`
1351
1349
1352
-
When a module needs a certain feature, typically as indicated by `db.supports`, but that feature is not available on a database argument or other. For example, some kind of plugin may depend on `seek()`:
1350
+
When a module needs a certain feature, typically as indicated by `db.supports`, but that feature is not available on a database argument or other. For example, some kind of plugin may depend on snapshots:
1353
1351
1354
1352
```js
1355
1353
constModuleError=require('module-error')
1356
1354
1357
1355
module.exports=functionplugin (db) {
1358
-
if (!db.supports.seek) {
1359
-
thrownewModuleError('Database must support seeking', {
1356
+
if (!db.supports.explicitSnapshots) {
1357
+
thrownewModuleError('Database must support snapshots', {
1360
1358
code:'LEVEL_NOT_SUPPORTED'
1361
1359
})
1362
1360
}
@@ -1767,7 +1765,7 @@ The default `_all()` is a functional default that makes repeated calls to `_next
1767
1765
1768
1766
#### `iterator._seek(target, options)`
1769
1767
1770
-
Seek to the key closest to `target`. The `options` object will always have the following properties: `keyEncoding`. This method is optional. The default will throw an error with code [`LEVEL_NOT_SUPPORTED`](#errors). If supported, set `db.supports.seek` to `true` (via the manifest passed to the database constructor) which also enables relevant tests in the [test suite](#test-suite).
1768
+
Seek to the key closest to `target`. The `options` object will always have the following properties: `keyEncoding`. The default `_seek()`will throw an error with code [`LEVEL_NOT_SUPPORTED`](#errors) and must be overridden.
1771
1769
1772
1770
#### `iterator._close()`
1773
1771
@@ -1921,7 +1919,7 @@ test('custom test', function (t) {
1921
1919
// ..
1922
1920
})
1923
1921
1924
-
testCommon.supports.seek&&test('another test', function (t) {
1922
+
testCommon.supports.explicitSnapshots&&test('another test', function (t) {
0 commit comments