mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-04-11 22:33:40 +00:00
Clean up a bit
This commit is contained in:
parent
8c2bb18697
commit
b4d1ebf54a
2 changed files with 0 additions and 26 deletions
|
@ -25,7 +25,6 @@ import (
|
||||||
"github.com/matrix-org/dendrite/roomserver/storage"
|
"github.com/matrix-org/dendrite/roomserver/storage"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/roomserver/types"
|
"github.com/matrix-org/dendrite/roomserver/types"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
@ -62,18 +61,14 @@ func (v *StateResolution) LoadStateAtSnapshot(
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
logrus.Warn("LISTS: ", stateEntryLists)
|
|
||||||
stateEntriesMap := stateEntryListMap(stateEntryLists)
|
stateEntriesMap := stateEntryListMap(stateEntryLists)
|
||||||
logrus.Warn("Map: ", stateEntriesMap)
|
|
||||||
|
|
||||||
// Combine all the state entries for this snapshot.
|
// Combine all the state entries for this snapshot.
|
||||||
// The order of state block NIDs in the list tells us the order to combine them in.
|
// The order of state block NIDs in the list tells us the order to combine them in.
|
||||||
var fullState []types.StateEntry
|
var fullState []types.StateEntry
|
||||||
for _, stateBlockNID := range stateBlockNIDList.StateBlockNIDs {
|
for _, stateBlockNID := range stateBlockNIDList.StateBlockNIDs {
|
||||||
logrus.Warn("Looking up ", stateBlockNID)
|
|
||||||
entries, ok := stateEntriesMap.lookup(stateBlockNID)
|
entries, ok := stateEntriesMap.lookup(stateBlockNID)
|
||||||
if !ok {
|
if !ok {
|
||||||
logrus.Warnf("State block NID %d: %+v", stateBlockNID, entries)
|
|
||||||
// This should only get hit if the database is corrupt.
|
// This should only get hit if the database is corrupt.
|
||||||
// It should be impossible for an event to reference a NID that doesn't exist
|
// It should be impossible for an event to reference a NID that doesn't exist
|
||||||
panic(fmt.Errorf("Corrupt DB: Missing state block numeric ID %d", stateBlockNID))
|
panic(fmt.Errorf("Corrupt DB: Missing state block numeric ID %d", stateBlockNID))
|
||||||
|
|
|
@ -130,31 +130,10 @@ func (d *Database) StateEntriesForTuples(
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("d.EventsTable.BulkSelectStateEventByNID: %w", err)
|
return nil, fmt.Errorf("d.EventsTable.BulkSelectStateEventByNID: %w", err)
|
||||||
}
|
}
|
||||||
//if len(stateKeyTuples) == 0 {
|
|
||||||
lists = append(lists, types.StateEntryList{
|
lists = append(lists, types.StateEntryList{
|
||||||
StateBlockNID: stateBlockNIDs[i],
|
StateBlockNID: stateBlockNIDs[i],
|
||||||
StateEntries: entries,
|
StateEntries: entries,
|
||||||
})
|
})
|
||||||
/*} else {
|
|
||||||
eventTypes := map[types.EventTypeNID]struct{}{}
|
|
||||||
stateKeys := map[types.EventStateKeyNID]struct{}{}
|
|
||||||
for _, t := range stateKeyTuples {
|
|
||||||
eventTypes[t.EventTypeNID] = struct{}{}
|
|
||||||
stateKeys[t.EventStateKeyNID] = struct{}{}
|
|
||||||
}
|
|
||||||
filteredEntries := []types.StateEntry{}
|
|
||||||
for _, entry := range entries {
|
|
||||||
_, tok := eventTypes[entry.EventTypeNID]
|
|
||||||
_, sok := stateKeys[entry.EventStateKeyNID]
|
|
||||||
if tok && sok {
|
|
||||||
filteredEntries = append(filteredEntries, entry)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lists = append(lists, types.StateEntryList{
|
|
||||||
StateBlockNID: stateBlockNIDs[i],
|
|
||||||
StateEntries: filteredEntries,
|
|
||||||
})
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
return lists, nil
|
return lists, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue