Remove unused SyncStreamPosition

main
Neil Alexander 2020-09-01 10:26:02 +01:00
parent f7b2a5866e
commit b0d2b39739
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944
2 changed files with 0 additions and 31 deletions

View File

@ -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:

View File

@ -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.