pub enum Update<Item, Gap> {
NewItemsChunk {
previous: Option<ChunkIdentifier>,
new: ChunkIdentifier,
next: Option<ChunkIdentifier>,
},
NewGapChunk {
previous: Option<ChunkIdentifier>,
new: ChunkIdentifier,
next: Option<ChunkIdentifier>,
gap: Gap,
},
RemoveChunk(ChunkIdentifier),
PushItems {
at: Position,
items: Vec<Item>,
},
RemoveItem {
at: Position,
},
DetachLastItems {
at: Position,
},
StartReattachItems,
EndReattachItems,
Clear,
}
Expand description
Represent the updates that have happened inside a LinkedChunk
.
To retrieve the updates, use LinkedChunk::updates
.
These updates are useful to store a LinkedChunk
in another form of
storage, like a database or something similar.
Variants§
NewItemsChunk
A new chunk of kind Items has been created.
Fields
previous: Option<ChunkIdentifier>
The identifier of the previous chunk of this new chunk.
new: ChunkIdentifier
The identifier of the new chunk.
next: Option<ChunkIdentifier>
The identifier of the next chunk of this new chunk.
NewGapChunk
A new chunk of kind Gap has been created.
Fields
previous: Option<ChunkIdentifier>
The identifier of the previous chunk of this new chunk.
new: ChunkIdentifier
The identifier of the new chunk.
next: Option<ChunkIdentifier>
The identifier of the next chunk of this new chunk.
gap: Gap
The content of the chunk.
RemoveChunk(ChunkIdentifier)
A chunk has been removed.
PushItems
Items are pushed inside a chunk of kind Items.
Fields
at: Position
The Position
of the items.
This value is given to prevent the need for position computations by
the update readers. Items are pushed, so the positions should be
incrementally computed from the previous items, which requires the
reading of the last previous item. With at
, the update readers no
longer need to do so.
RemoveItem
An item has been removed inside a chunk of kind Items.
DetachLastItems
The last items of a chunk have been detached, i.e. the chunk has been truncated.
Fields
StartReattachItems
Detached items (see Self::DetachLastItems
) starts being reattached.
EndReattachItems
Reattaching items (see Self::StartReattachItems
) is finished.
Clear
All chunks have been cleared, i.e. all items and all gaps have been dropped.