pubsub

package
v0.99.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 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 {
	DeviceID string
	Pos      int64
}

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 V2InitialSyncComplete

type V2InitialSyncComplete struct {
	UserID   string
	DeviceID string
}

func (*V2InitialSyncComplete) Type

func (*V2InitialSyncComplete) Type() string

type V2Initialise

type V2Initialise struct {
	RoomID      string
	SnapshotNID int64
}

func (*V2Initialise) Type

func (*V2Initialise) 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
}

func (*V2LeaveRoom) Type

func (*V2LeaveRoom) Type() string

type V2Listener

type V2Listener interface {
	Initialise(p *V2Initialise)
	Accumulate(p *V2Accumulate)
	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)
}

type V2Receipt

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

func (*V2Receipt) Type

func (*V2Receipt) 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 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 {
	UserID   string
	DeviceID string
}

func (*V3EnsurePolling) Type

func (*V3EnsurePolling) Type() string

type V3Listener

type V3Listener interface {
	EnsurePolling(p *V3EnsurePolling)
}

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