atom-archive / xray

An experimental next-generation Electron-based text editor
MIT License
8.48k stars 235 forks source link

Add Buffer.prototype.getDeferredOperationCount #169

Closed as-cii closed 5 years ago

as-cii commented 5 years ago

This pull request introduces a new method on Buffer that allows to retrieve how many operations haven't been applied yet due to a deferral, in an effort to start adding observability into memo's internal state.

We have pretty good confidence that, so long as all messages are delivered, the system will converge. However, higher layers in the stack (e.g., networking, storage, etc.) may cause memo not to see every operation, and so this new simple function will help take operation delivery out of the equation (if the deferred count is zero).

/cc: @joshaber

joshaber commented 5 years ago

I won't pretend to review the Rust, but the expectations and API look right! 👍 💯