hypercore-protocol / hypercore-next

Hypercore 10 is an append only log with multi-writer primitives built in.
MIT License
150 stars 15 forks source link

Add core.close #26

Closed andrewosh closed 3 years ago

andrewosh commented 3 years ago

Added a close method to lib/core.js (the top-level close currently fails).

Requires adding a destroy method to the mutex, which either gracefully waits for pending tasks to complete (the default behavior), or will eagerly reject them if an error is provided.

Since Hypercore.close() does not currently accept an err parameter, the eager destroy is unused, but this might be added later.