pubsub

package
v0.99.19 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 8 Imported by: 1 module, 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

View Source
const ChanV2 = "v2ch"

The channel which has V2* payloads

View Source
const ChanV3 = "v3ch"

The channel which has V3* payloads

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

type Listener interface {
	// Begin listening on this channel with this callback starting from this position. Blocks until Close() is called.
	Listen(chanName string, fn func(p Payload)) error
	// Close the listener. No more callbacks should fire.
	Close() error
}

Listener represents the common functions required by all subscription listeners

type Notifier

type Notifier interface {
	// Notify chanName that there is a new payload p. Return an error if we failed to send the notification.
	Notify(chanName string, p Payload) error
	// Close is called when we should stop listening.
	Close() error
}

Notifier represents the common functions required by all notifiers

func NewPromNotifier

func NewPromNotifier(n Notifier, subsystem string) Notifier

Wrap a notifier for prometheus metrics

type Payload

type Payload interface {
	// The type of payload; used mostly for logging and prometheus metrics
	Type() string
}

type PromNotifier

type PromNotifier struct {
	Notifier
	// contains filtered or unexported fields
}

Wrapper around a Notifier which adds Prometheus metrics

func (*PromNotifier) Close

func (p *PromNotifier) Close() error

func (*PromNotifier) Notify

func (p *PromNotifier) Notify(chanName string, payload Payload) error

type PubSub

type PubSub struct {
	// contains filtered or unexported fields
}

func NewPubSub

func NewPubSub(bufferSize int) *PubSub

func (*PubSub) Close

func (ps *PubSub) Close() error

func (*PubSub) Listen

func (ps *PubSub) Listen(chanName string, fn func(p Payload)) error

func (*PubSub) Notify

func (ps *PubSub) Notify(chanName string, p Payload) error

type V2AccountData

type V2AccountData struct {
	UserID string
	RoomID string
	Types  []string
}

func (*V2AccountData) Type

func (*V2AccountData) Type() string

type V2Accumulate

type V2Accumulate struct {
	RoomID    string
	PrevBatch string
	EventNIDs []int64
}

func (*V2Accumulate) Type

func (*V2Accumulate) Type() string

type V2DeviceData

type V2DeviceData struct {
	UserIDToDeviceIDs map[string][]string
}

func (*V2DeviceData) Type

func (*V2DeviceData) Type() string

type V2DeviceMessages added in v0.98.1

type V2DeviceMessages struct {
	UserID   string
	DeviceID string
}

func (*V2DeviceMessages) Type added in v0.98.1

func (*V2DeviceMessages) Type() string

type V2ExpiredToken added in v0.99.2

type V2ExpiredToken struct {
	UserID   string
	DeviceID string
}

func (*V2ExpiredToken) Type added in v0.99.2

func (*V2ExpiredToken) Type() string

type V2InitialSyncComplete

type V2InitialSyncComplete struct {
	UserID   string
	DeviceID string
	Success  bool
}

func (*V2InitialSyncComplete) Type

func (*V2InitialSyncComplete) Type() string

type V2Initialise

type V2Initialise struct {
	RoomID      string
	SnapshotNID int64
}

func (*V2Initialise) Type

func (*V2Initialise) Type() string

type V2InvalidateRoom added in v0.99.11

type V2InvalidateRoom struct {
	RoomID string
}

V2InvalidateRoom is emitted after a non-incremental state change to a room, in place of a V2Initialise payload.

func (*V2InvalidateRoom) Type added in v0.99.11

func (*V2InvalidateRoom) Type() string

type V2InviteRoom

type V2InviteRoom struct {
	UserID string
	RoomID string
}

func (*V2InviteRoom) Type

func (*V2InviteRoom) Type() string

type V2LeaveRoom

type V2LeaveRoom struct {
	UserID     string
	RoomID     string
	LeaveEvent json.RawMessage
}

func (*V2LeaveRoom) Type

func (*V2LeaveRoom) Type() string

type V2Listener

type V2Listener interface {
	Initialise(p *V2Initialise)
	Accumulate(p *V2Accumulate)
	OnTransactionID(p *V2TransactionID)
	OnAccountData(p *V2AccountData)
	OnInvite(p *V2InviteRoom)
	OnLeftRoom(p *V2LeaveRoom)
	OnUnreadCounts(p *V2UnreadCounts)
	OnInitialSyncComplete(p *V2InitialSyncComplete)
	OnDeviceData(p *V2DeviceData)
	OnTyping(p *V2Typing)
	OnReceipt(p *V2Receipt)
	OnDeviceMessages(p *V2DeviceMessages)
	OnExpiredToken(p *V2ExpiredToken)
	OnInvalidateRoom(p *V2InvalidateRoom)
	OnStateRedaction(p *V2StateRedaction)
}

V2Listener describes the messages that sync v2 pollers will publish.

type V2Receipt

type V2Receipt struct {
	RoomID   string
	Receipts []internal.Receipt
}

func (*V2Receipt) Type

func (*V2Receipt) Type() string

type V2StateRedaction added in v0.99.12

type V2StateRedaction struct {
	RoomID string
}

V2StateRedaction is emitted when a timeline is seen that contains one or more redaction events targeting a piece of room state. The redaction will be emitted before its corresponding V2Accumulate payload is emitted.

func (*V2StateRedaction) Type added in v0.99.12

func (*V2StateRedaction) Type() string

type V2Sub

type V2Sub struct {
	// contains filtered or unexported fields
}

func NewV2Sub

func NewV2Sub(l Listener, recv V2Listener) *V2Sub

func (*V2Sub) Listen

func (v *V2Sub) Listen() error

func (*V2Sub) Teardown

func (v *V2Sub) Teardown()

type V2TransactionID added in v0.99.3

type V2TransactionID struct {
	EventID       string
	RoomID        string
	UserID        string // of the sender
	DeviceID      string
	TransactionID string // Note: an empty transaction ID represents the all-clear.
	NID           int64
}

V2TransactionID is emitted by a poller when it sees an event with a transaction ID, or when it is certain that no other poller will see a transaction ID for this event (the "all-clear").

func (*V2TransactionID) Type added in v0.99.3

func (*V2TransactionID) Type() string

type V2Typing

type V2Typing struct {
	RoomID         string
	EphemeralEvent json.RawMessage
}

func (*V2Typing) Type

func (*V2Typing) Type() string

type V2UnreadCounts

type V2UnreadCounts struct {
	UserID            string
	RoomID            string
	HighlightCount    *int
	NotificationCount *int
}

func (*V2UnreadCounts) Type

func (*V2UnreadCounts) Type() string

type V3EnsurePolling

type V3EnsurePolling struct {
	// TODO: we only really need to provide the access token hash here.
	// Passing through a user means we can log something sensible though.
	UserID          string
	DeviceID        string
	AccessTokenHash string
}

func (*V3EnsurePolling) Type

func (*V3EnsurePolling) Type() string

type V3Listener

type V3Listener interface {
	EnsurePolling(p *V3EnsurePolling)
}

V3Listener describes the messages that incoming sliding sync requests will publish.

type V3Sub

type V3Sub struct {
	// contains filtered or unexported fields
}

func NewV3Sub

func NewV3Sub(l Listener, recv V3Listener) *V3Sub

func (*V3Sub) Listen

func (v *V3Sub) Listen() error

func (*V3Sub) Teardown

func (v *V3Sub) Teardown()

Jump to

Keyboard shortcuts

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