Level / abstract-leveldown

An abstract prototype matching the leveldown API.
MIT License
146 stars 53 forks source link

Make db argument of iterator and chained batch required #255

Closed vweevers closed 6 years ago

vweevers commented 6 years ago

So that iterators and chained batches will always have a db property (or _db, normalizing that is a second question). This prevents garbage collection of db.

https://github.com/Level/abstract-leveldown/blob/7b079c5510f0ae354ae9503849ac7d9a0aa01551/abstract-iterator.js#L1-L2

https://github.com/Level/abstract-leveldown/blob/7b079c5510f0ae354ae9503849ac7d9a0aa01551/abstract-chained-batch.js#L1-L2


vweevers commented 6 years ago

In addition, if _db is guaranteed to be there, we no longer need these "proxy" methods:

https://github.com/Level/abstract-leveldown/blob/7b079c5510f0ae354ae9503849ac7d9a0aa01551/abstract-chained-batch.js#L7-L13

vweevers commented 6 years ago

Should it be iterator.db (public) or iterator._db?

ralphtheninja commented 6 years ago

Should it be iterator.db (public) or iterator._db?

I have no strong opinion. If public it should be documented I guess.

vweevers commented 6 years ago

Let's go with public + docs. No particular reason.