holepunchto/hyperbee

Share batch between subs

Opened this issue · 0 comments

It'd be nice to use a single batch between several subs.

e.g. sub.batch({batch: dbBatch}) to specify a parent batch to append onto with the sub batch. Specifying an existing batch to add onto with a sub vs using batch.sub(prefix) is useful because people often deal with db instances instead of memorizing prefixes.

This is useful when you're inserting or deleting from several subs at once, for example here in hyperbeedeebee where I'm inserting keys into several subs used for indexing documents.