Define new pubsub for txnids

This commit is contained in:
David Robertson 2023-06-10 12:10:38 +01:00
parent 7ee8642720
commit 32f393ddac
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD
2 changed files with 19 additions and 0 deletions

View File

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

View File

@ -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")