Mutability and flumedb
Riffing off of my issue:
I'm under the impression that some view backends (e.g. Level) gives us the option of mutating a piece of data after the fact, which seems like it could be useful for encrypted groups, mutable messages, and blob content. Would it be possible to get a view like flumeview-level to regenerate views for a subset of messages rather than regenerate the entire view, or would this have unintended consequences?
- encrypted groups: when you get access to a new group key, regenerate views for all private messages
- mutable messages: when you get an
type: edit
message, regenerate the views for the referenced message- blob content: when you get a new blob, regenerate the views for each
type: blob
message that references that blobcc: @dominic
I'm not very familiar with the intimate details of flumedb, but over time I've been getting more concerned about mutability in our append-only database. I've prototyped a hacky application that can delete data from the instance of flumelog-offset that powers Scuttlebutt, but it requires:
- Restarting Scuttlebutt.
- Destroying all views in
~/.ssb/flume/
. - Rebuilding views when you open an application that needs them.
It's probably possible to fix the first problem, but the other two seem hard: if you modify the log then you must rebuild the views that depend on it, but there's no way to tell which application generated the views in the first place. Unfortunately, mutability is required any time we're exposed to new information that would change a view:
- If we block a user and delete their feed, the view won't reflect that.
- If we receive a blob after receiving a #blob-content message then the view won't reflect that.
- If we're added to a private group (or receive an unbox key) then the view won't reflect that.
The only tool we have to deal with this is to destroy all views and then rebuild them all when the right application is started. This means that you might open one application, wait five minutes for it to finish building views, and then have the same experience with a different application a week later because they may use different views (based on the same log).
While each feed may be append-only, I don't think that means our database has to be append-only as well. The ability to delete data from a flumelog seems critical for the scalability and maintenance of the network. I'd love some feedback on the feasibility of various solutions, or ideas on how to solve this!
- Implementing a
flumelog.delete()
method that takes a sequence number (or array of seqs) as input.- Unfortunately I think this would have to be done on each flumelog, but otherwise seems simple enough.
- Implementing a way to delete individual messages from a flumeview without rebuilding the whole thing.
- This would require that each flumeview ships with an inverse function that's capable of removing messages as well.
- Rebuilding individual messages (for new blobs or unbox keys) would be triggered by removing and re-adding a message.
Sparked by %1bz0TXD... and %YMUkbRH....
#apps #scuttlebot #scuttleshell #flume #flumedb #against-consensus