handler2

package
v0.7.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Store *state.Storage
	// contains filtered or unexported fields
}

Handler is responsible for starting v2 pollers at startup, processing v2 data and publishing updates, and receiving and processing EnsurePolling events.

func NewHandler

func NewHandler(
	connStr string, pMap *sync2.PollerMap, v2Store *sync2.Storage, store *state.Storage, client sync2.Client,
	pub pubsub.Notifier, sub pubsub.Listener, enablePrometheus bool,
) (*Handler, error)

func (*Handler) Accumulate

func (h *Handler) Accumulate(userID, roomID, prevBatch string, timeline []json.RawMessage)

send room ID and prev batch, latest pos and event nids of timeline entries in NOTIFY. SELECT event nids for timeline.

func (*Handler) AddToDeviceMessages

func (h *Handler) AddToDeviceMessages(userID, deviceID string, msgs []json.RawMessage)

Send nothing, the v3 API will pull from the DB directly; no in-memory shenanigans

func (*Handler) EnsurePolling

func (h *Handler) EnsurePolling(p *pubsub.V3EnsurePolling)

func (*Handler) Initialise

func (h *Handler) Initialise(roomID string, state []json.RawMessage)

send room ID and snapshot NID in NOTIFY, send nothing if already init'd.

func (*Handler) Listen

func (h *Handler) Listen()

Listen starts all consumers

func (*Handler) OnAccountData

func (h *Handler) OnAccountData(userID, roomID string, events []json.RawMessage)

send user/room ID and types in NOTIFY, query account data. This can lose updates (most recent wins) but is probably fine

func (*Handler) OnE2EEData

func (h *Handler) OnE2EEData(userID, deviceID string, otkCounts map[string]int, fallbackKeyTypes []string, deviceListChanges map[string]int)

func (*Handler) OnInvite

func (h *Handler) OnInvite(userID, roomID string, inviteState []json.RawMessage)

send user/room ID in NOTIFY, query state using user/room ID

func (*Handler) OnLeftRoom

func (h *Handler) OnLeftRoom(userID, roomID string)

send all fields in NOTIFY

func (*Handler) OnReceipt added in v0.7.3

func (h *Handler) OnReceipt(userID, roomID, ephEventType string, ephEvent json.RawMessage)

func (*Handler) OnTerminated added in v0.5.1

func (h *Handler) OnTerminated(userID, deviceID string)

func (*Handler) SetTyping

func (h *Handler) SetTyping(roomID string, ephEvent json.RawMessage)

send all in NOTIFY

func (*Handler) StartV2Pollers

func (h *Handler) StartV2Pollers()

func (*Handler) Teardown

func (h *Handler) Teardown()

func (*Handler) UpdateDeviceSince

func (h *Handler) UpdateDeviceSince(deviceID, since string)

Emits nothing as no downstream components need it.

func (*Handler) UpdateUnreadCounts

func (h *Handler) UpdateUnreadCounts(roomID, userID string, highlightCount, notifCount *int)

send all fields in NOTIFY

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL