flumeview-level
Advanced tools
+17
-9
@@ -72,11 +72,19 @@ 'use strict' | ||
| // The `writer` object is `undefined` on startup, so we need to ensure | ||
| // that the writer actually exists before attempting to abort it. | ||
| if (writer) { | ||
| writer.abort(() => { | ||
| db.clear(cb) | ||
| }) | ||
| } else { | ||
| db.clear(cb) | ||
| } | ||
| // The `clear()` method must run before the stream is closed, otherwise | ||
| // you can have a situation where you: | ||
| // | ||
| // 1. Flumeview-Level closes the stream | ||
| // 2. FlumeDB restarts the stream | ||
| // 3. Flumeview-Level processes a message | ||
| // 4. Flumeview-Level runs `db.clear()` and deletes that message. | ||
| // | ||
| db.clear((err) => { | ||
| // The `writer` object is `undefined` on startup, so we need to ensure | ||
| // that the writer actually exists before attempting to abort it. | ||
| if (err == null && writer) { | ||
| writer.abort(cb) | ||
| } else { | ||
| cb(err) | ||
| } | ||
| }) | ||
| } | ||
@@ -83,0 +91,0 @@ |
+5
-5
| { | ||
| "name": "flumeview-level", | ||
| "description": "a flumeview on level", | ||
| "version": "4.0.2", | ||
| "version": "4.0.3", | ||
| "homepage": "https://github.com/flumedb/flumeview-level", | ||
@@ -24,10 +24,10 @@ "repository": { | ||
| "flumecodec": "0.0.1", | ||
| "flumedb": "^2.1.3", | ||
| "flumedb": "^2.1.4", | ||
| "flumelog-offset": "^3.4.4", | ||
| "tape": "^4.13.3", | ||
| "test-flumeview-index": "^2.2.5" | ||
| "tape": "^5.0.0", | ||
| "test-flumeview-index": "^2.3.1" | ||
| }, | ||
| "scripts": { | ||
| "// Warning": "The 'test' script below is haunted. Edit with caution", | ||
| "test": "node test/index.js && node test/live.js && node test/bench.js" | ||
| "test": "tape 'test/{index,live,bench}.js'" | ||
| }, | ||
@@ -34,0 +34,0 @@ "author": "'Dominic Tarr' <dominic.tarr@gmail.com> (dominictarr.com)", |
+1
-1
@@ -8,3 +8,3 @@ | ||
| require('test-flumeview-index/bench')(function (file, seed) { | ||
| return Flume(Log(file+'log.offset', 1024, codec.json)) | ||
| return Flume(Log(file+'/log.offset', 1024, codec.json)) | ||
| .use('index', Index(1, function (e) { return [e.key] })) | ||
@@ -11,0 +11,0 @@ }) |
17166
2.02%303
2.71%