notification

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalNotificationService

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

func NewLocalNotificationService

func NewLocalNotificationService(capacity int) *LocalNotificationService

func (*LocalNotificationService) Close

func (lns *LocalNotificationService) Close() error

func (*LocalNotificationService) CloseTopics

func (lns *LocalNotificationService) CloseTopics(topics ...string) error

func (*LocalNotificationService) Publish

func (lns *LocalNotificationService) Publish(msg any, wait, broadcast bool, topics ...string) error

func (*LocalNotificationService) Subscribe

func (lns *LocalNotificationService) Subscribe(topics ...string) (chan any, error)

func (*LocalNotificationService) Unsubscribe

func (lns *LocalNotificationService) Unsubscribe(ch chan any, topics ...string) error

type Message

type Message struct {
	SubID string
	Msg   any
}

type MessageProcessorFn

type MessageProcessorFn func(subID string, msg any) error

type RemoteNotificationService

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

func NewRemoteNotificationService

func NewRemoteNotificationService(dc WSDialerCreator, maxRedials int) (*RemoteNotificationService, error)

func (*RemoteNotificationService) Close

func (rns *RemoteNotificationService) Close() error

func (*RemoteNotificationService) CloseTopics

func (rns *RemoteNotificationService) CloseTopics(topics ...string) error

func (*RemoteNotificationService) Publish

func (rns *RemoteNotificationService) Publish(msg any, wait, broadcast bool, topics ...string) error

func (*RemoteNotificationService) Subscribe

func (rns *RemoteNotificationService) Subscribe(topics ...string) (chan any, error)

func (*RemoteNotificationService) Unsubscribe

func (rns *RemoteNotificationService) Unsubscribe(ch chan any, topics ...string) error

type Service

type Service interface {
	Publish(msg any, wait, broadcast bool, topics ...string) error
	Subscribe(topics ...string) (chan any, error)
	Unsubscribe(ch chan any, topics ...string) error
	CloseTopics(topics ...string) error
	io.Closer
}

Service is an interface to Notification Service that enables different parts of the MetaLocker platform to publish and subscribe to events of interest, such as new ledger block generation, etc.

type ServiceCreatorFn

type ServiceCreatorFn func() (Service, error)

type SubscriberProxy

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

func NewSubscriberProxy

func NewSubscriberProxy(id string, ns Service, ch chan any, fn MessageProcessorFn) *SubscriberProxy

func (*SubscriberProxy) Close

func (sp *SubscriberProxy) Close()

Close will close the internal channel and stop receiving messages

type WSDialerCreator

type WSDialerCreator func() (*websocket.Conn, error)

Jump to

Keyboard shortcuts

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