Implementation of the supplement ADT that uses a wavelet as the underlying data structure. The wavelet uses separate documents for each of:
- read-state
- folder state
- archiving state
- muted state
- abuse
- seen-state and pending-notifications state
The read state is tracked in an element per wavelet. That element tracks blip read-versions, the participants read-version, and the wavelet-override version, using the {@link DocumentBasedMonotonicMap} and{@link DocumentBasedMonotonicValue} embeddings. Below is an example state ofthe read-state document.
<data> <wavelet i="example.org!conv+root"> <all v="25"/> <participants v="12"/> <blip i="8fJd77*2" v="7"/> <all v="28"/> <blip i="8fJd77*7" v="38"/> <blip i="8fJd77*7" v="11"/> </wavelet> <wavelet i="conversation/dRwppo8*34"> <blip i="dRwppo8*35" v="4"/> <blip i="dRwppo8*36" v="15"/> </wavelet> </data>
The interpretation of that state, as provided by {@link DocumentBasedMonotonicMap} and {@link DocumentBasedMonotonicValue}, is:
- wavelet {@code example.org!conv+root} has a wavelet read-version of 28, aparticipants read-version of 12, a read version of 7 for blip {@code 8fJd77*2}, and a read version of 38 for blip {@code 8fJd77*7}.
- wavelet {@code conversation/dRwppo8*34} has a read version of 4 for blip{@code dRwppo8*35} and a read version of 15 for blip {@code dRwppo8*36}.
The folder state is tracked in an element per folder, according to the {@link DocumentBasedBasicSet} embedding. An example folder state:
<data> <folder i="3"/> <folder i="12"/> <folder i="12"/> </data>
The interpretation of that state is that the wave is in folders 3 and 12. The archiving state is tracked in an element per wavelet, with a map of wavelet ids and versions. When a wave is archived, all the versions of its conversation wavelets are saved in the archiving document. An example archiving state:
<data> <archive i="example.org!conv+root" v="48" /> <archive i="conversation/dRwppo8*34" v="15" /> </data>
The interpretation of that state is that the wave is {@link InboxState#ARCHIVE archived} as long as its wavelet versions don't goabove 48 for "root" and 15 for "dRwppo8*34". The muted state is reflected by two boolean values, stored in two separate documents. TODO(hearnden/flopiano): improve the handling of mute and clear to be less wasteful. Example:
<data muted="true" />
Abuse State is managed by the {@link DocumentBasedAbuseStore} class.