mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 03:31:41 +00:00
Remove unused SyncStreamPosition
This commit is contained in:
parent
f7b2a5866e
commit
b0d2b39739
@ -104,8 +104,6 @@ type Database interface {
|
||||
// matches the streamevent.transactionID device then the transaction ID gets
|
||||
// added to the unsigned section of the output event.
|
||||
StreamEventsToEvents(device *userapi.Device, in []types.StreamEvent) []gomatrixserverlib.HeaderedEvent
|
||||
// SyncStreamPosition returns the latest position in the sync stream. Returns 0 if there are no events yet.
|
||||
SyncStreamPosition(ctx context.Context) (types.StreamPosition, error)
|
||||
// AddSendToDevice increases the EDU position in the cache and returns the stream position.
|
||||
AddSendToDevice() types.StreamPosition
|
||||
// SendToDeviceUpdatesForSync returns a list of send-to-device updates. It returns three lists:
|
||||
|
@ -133,35 +133,6 @@ func (d *Database) GetStateEventsForRoom(
|
||||
return
|
||||
}
|
||||
|
||||
func (d *Database) SyncStreamPosition(ctx context.Context) (types.StreamPosition, error) {
|
||||
var maxID int64
|
||||
var err error
|
||||
err = sqlutil.WithTransaction(d.DB, func(txn *sql.Tx) error {
|
||||
maxID, err = d.OutputEvents.SelectMaxEventID(ctx, txn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var maxAccountDataID int64
|
||||
maxAccountDataID, err = d.AccountData.SelectMaxAccountDataID(ctx, txn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if maxAccountDataID > maxID {
|
||||
maxID = maxAccountDataID
|
||||
}
|
||||
var maxInviteID int64
|
||||
maxInviteID, err = d.Invites.SelectMaxInviteID(ctx, txn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if maxInviteID > maxID {
|
||||
maxID = maxInviteID
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return types.StreamPosition(maxID), err
|
||||
}
|
||||
|
||||
// AddInviteEvent stores a new invite event for a user.
|
||||
// If the invite was successfully stored this returns the stream ID it was stored at.
|
||||
// Returns an error if there was a problem communicating with the database.
|
||||
|
Loading…
Reference in New Issue
Block a user