mirror of
https://github.com/matrix-org/sliding-sync.git
synced 2025-03-10 13:37:11 +00:00
Define new pubsub for txnids
This commit is contained in:
parent
7ee8642720
commit
32f393ddac
12
pubsub/v2.go
12
pubsub/v2.go
@ -13,6 +13,7 @@ const ChanV2 = "v2ch"
|
||||
type V2Listener interface {
|
||||
Initialise(p *V2Initialise)
|
||||
Accumulate(p *V2Accumulate)
|
||||
OnTransactionID(p *V2TransactionID)
|
||||
OnAccountData(p *V2AccountData)
|
||||
OnInvite(p *V2InviteRoom)
|
||||
OnLeftRoom(p *V2LeaveRoom)
|
||||
@ -40,6 +41,15 @@ type V2Accumulate struct {
|
||||
|
||||
func (*V2Accumulate) Type() string { return "V2Accumulate" }
|
||||
|
||||
// V2TransactionID is emitted by a poller when it sees an event with a transaction ID.
|
||||
type V2TransactionID struct {
|
||||
EventID string
|
||||
TransactionID string
|
||||
NID int64
|
||||
}
|
||||
|
||||
func (*V2TransactionID) Type() string { return "V2TransactionID" }
|
||||
|
||||
type V2UnreadCounts struct {
|
||||
UserID string
|
||||
RoomID string
|
||||
@ -138,6 +148,8 @@ func (v *V2Sub) onMessage(p Payload) {
|
||||
v.receiver.Initialise(pl)
|
||||
case *V2Accumulate:
|
||||
v.receiver.Accumulate(pl)
|
||||
case *V2TransactionID:
|
||||
v.receiver.OnTransactionID(pl)
|
||||
case *V2AccountData:
|
||||
v.receiver.OnAccountData(pl)
|
||||
case *V2InviteRoom:
|
||||
|
@ -597,6 +597,13 @@ func (h *SyncLiveHandler) Accumulate(p *pubsub.V2Accumulate) {
|
||||
}
|
||||
}
|
||||
|
||||
// OnTransactionID is called from the v2 poller, implements V2DataReceiver.
|
||||
func (h *SyncLiveHandler) OnTransactionID(p *pubsub.V2TransactionID) {
|
||||
_, task := internal.StartTask(context.Background(), "TransactionID")
|
||||
defer task.End()
|
||||
// TODO implement me
|
||||
}
|
||||
|
||||
// Called from the v2 poller, implements V2DataReceiver
|
||||
func (h *SyncLiveHandler) Initialise(p *pubsub.V2Initialise) {
|
||||
ctx, task := internal.StartTask(context.Background(), "Initialise")
|
||||
|
Loading…
x
Reference in New Issue
Block a user