handler2

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) OnTerminated added in v0.5.1

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

func (*Handler) SetTyping

func (h *Handler) SetTyping(roomID string, userIDs []string)

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