hyperdrive
Advanced tools
Comparing version 11.11.0 to 11.12.0
16
index.js
@@ -13,2 +13,3 @@ const Hyperbee = require('hyperbee') | ||
const { BLOCK_NOT_AVAILABLE, BAD_ARGUMENT } = require('hypercore-errors') | ||
const Monitor = require('./lib/monitor') | ||
@@ -34,2 +35,3 @@ const keyEncoding = new SubEncoder('files', 'utf-8') | ||
this.encryptionKey = opts.encryptionKey || null | ||
this.monitors = new Set() | ||
@@ -193,2 +195,4 @@ this._active = opts.active !== false | ||
} | ||
await this.closeMonitors() | ||
} | ||
@@ -284,2 +288,14 @@ | ||
monitor (name, opts = {}) { | ||
const monitor = new Monitor(this, { name, ...opts }) | ||
this.monitors.add(monitor) | ||
return monitor | ||
} | ||
async closeMonitors () { | ||
const closing = [] | ||
for (const monitor of this.monitors) closing.push(monitor.close()) | ||
await Promise.allSettled(closing) | ||
} | ||
async get (name, opts) { | ||
@@ -286,0 +302,0 @@ const node = await this.entry(name, opts) |
{ | ||
"name": "hyperdrive", | ||
"version": "11.11.0", | ||
"version": "11.12.0", | ||
"description": "Hyperdrive is a secure, real-time distributed file system", | ||
@@ -32,2 +32,3 @@ "main": "index.js", | ||
"safety-catch": "^1.0.2", | ||
"speedometer": "^1.1.0", | ||
"streamx": "^2.12.4", | ||
@@ -34,0 +35,0 @@ "sub-encoder": "^2.1.1", |
@@ -197,2 +197,8 @@ # Hyperdrive | ||
#### `await drive.truncate(version, [options] })` | ||
Truncates the Hyperdrive to a previous version (both the file-structure reference and the blobs). | ||
A `blobs: <length>` option can be passed in if you know the corresponding blobs length, but it is recommended to let the method figure it out for you. | ||
#### `await drive.purge()` | ||
@@ -380,4 +386,8 @@ | ||
#### `const blobsLength = await drive.getBlobsLength(checkout)` | ||
Returns the length of the Hyperblobs instance at the time of the specified Hyperdrive version (defaults to the current version). | ||
## License | ||
Apache-2.0 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45495
5
668
392
12
+ Addedspeedometer@^1.1.0
+ Addedspeedometer@1.1.0(transitive)