Open
Description
In #145 I discussed the possibility of implementing a filesystem. What I'm wondering now is how I could support lazy loading, i.e. build a collection where each document contains only the filename at the beginning and, when a file's contents are requested, they would be read from disk and stored in the corresponding document.
I tried sharedb.use('receive', callback)
to intercept all requests to the database, and inside the callback doc.fetch(...)
and doc.submitOp(...)
to populate the missing data, but the callback is called for each of these two calls. How can I distinguish if the callback is called because it was triggered by a client or the server? Is there a more convenient way to do this?