mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 15:03:09 -06:00
More comments on discarding empty blocks
This commit is contained in:
parent
066f9daae7
commit
322ee668ce
|
|
@ -26,6 +26,7 @@ type RoomStateDatabase interface {
|
||||||
StateEntries(stateBlockNIDs []types.StateBlockNID) ([]types.StateEntryList, error)
|
StateEntries(stateBlockNIDs []types.StateBlockNID) ([]types.StateEntryList, error)
|
||||||
// Lookup the state data for the state key tuples for each numeric state block ID
|
// Lookup the state data for the state key tuples for each numeric state block ID
|
||||||
// This is used to fetch a subset of the room state at a snapshot.
|
// This is used to fetch a subset of the room state at a snapshot.
|
||||||
|
// If a block doesn't contain any of the requested tuples then it can be discarded from the result.
|
||||||
// The returned slice is sorted by numeric state block ID.
|
// The returned slice is sorted by numeric state block ID.
|
||||||
StateEntriesForTuples(stateBlockNIDs []types.StateBlockNID, stateKeyTuples []types.StateKeyTuple) (
|
StateEntriesForTuples(stateBlockNIDs []types.StateBlockNID, stateKeyTuples []types.StateKeyTuple) (
|
||||||
[]types.StateEntryList, error,
|
[]types.StateEntryList, error,
|
||||||
|
|
@ -275,6 +276,8 @@ func loadStateAtSnapshotForNumericTuples(
|
||||||
entries, ok := stateEntriesMap.lookup(stateBlockNID)
|
entries, ok := stateEntriesMap.lookup(stateBlockNID)
|
||||||
if !ok {
|
if !ok {
|
||||||
// If the block is missing from the map it means that none of its entries matched a requested tuple.
|
// If the block is missing from the map it means that none of its entries matched a requested tuple.
|
||||||
|
// This can happen if the block doesn't contain an update for one of the requested tuples.
|
||||||
|
// If none of the requested tuples are in the block then it can be safely skipped.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fullState = append(fullState, entries...)
|
fullState = append(fullState, entries...)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue