subscribe

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: BSD-3-Clause Imports: 14 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheRemove added in v1.3.5

func CacheRemove(ctx context.Context, keys ...interface{})

func NewSubPub added in v1.3.5

func NewSubPub() *subPub

NewSubPub return a subPub

func ProcessMetricMsg added in v1.3.5

func ProcessMetricMsg(sub *rpc.Subscription, metrics []prometheus.Metric) (send bool, out map[string]interface{})

Types

type INotifier added in v1.3.5

type INotifier interface {
	Notify(key string, data interface{}) error
	Err() <-chan error
}

type Notifier added in v1.3.5

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

func NewNotifier added in v1.3.5

func NewNotifier(n *rpc.Notifier, sub *rpc.Subscription) *Notifier

NewNotifier wrap *rpc.INotifier to meet the interface named INotifier

func (*Notifier) Err added in v1.3.5

func (n *Notifier) Err() <-chan error

func (*Notifier) Notify added in v1.3.5

func (n *Notifier) Notify(_ string, data interface{}) error

type NotifierWithDelay added in v1.3.5

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

func NewNotifierWithDelay added in v1.3.5

func NewNotifierWithDelay(notifier *rpc.Notifier, sub *rpc.Subscription, delay int, sendArray bool) *NotifierWithDelay

NewNotifierWithDelay wrap *rpc.INotifier to add some extra features

func (*NotifierWithDelay) Err added in v1.3.5

func (n *NotifierWithDelay) Err() <-chan error

func (*NotifierWithDelay) Notify added in v1.3.5

func (n *NotifierWithDelay) Notify(key string, data interface{}) error

type NotifierWithMsgChan added in v1.3.5

type NotifierWithMsgChan struct {
	MsgChan chan interface{} // msg will be sent to this chan
	ErrChan chan error       // close this chan if you want to unsubscribe
}

func NewNotifierWithMsgChan added in v1.3.5

func NewNotifierWithMsgChan() *NotifierWithMsgChan

NewNotifierWithMsgChan return a notifier which will use method named Notify to send message to a field named MsgChan in the notifier

func (*NotifierWithMsgChan) Err added in v1.3.5

func (n *NotifierWithMsgChan) Err() <-chan error

func (*NotifierWithMsgChan) Notify added in v1.3.5

func (n *NotifierWithMsgChan) Notify(_ string, data interface{}) error

type SubPub added in v1.3.5

type SubPub interface {
	// Subscribe a subscription,creates a mapping from nameSpace_kind_param to INotifier
	Subscribe(iNotifier INotifier, nameSpace string, kind string, param string) error
	// Publish finds the notifier corresponding to the key nameSpace_kind_param, and then calls the Notify method of
	// notify to publish message
	Publish(nameSpace string, kind string, param string, message interface{}) error
	// PublishArray finds the notifier corresponding to the key nameSpace_kind_param, and then calls the Notify method of
	// notify to publish a group of message
	PublishArray(nameSpace string, kind string, field string, messageList []interface{}) error
}

Jump to

Keyboard shortcuts

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