subscription

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notice

type Notice struct {
	// SeqNum is a strictly increasing number between notice
	SeqNum         uint64
	SubscriptionID string
	Event          skydb.RecordHookEvent
	Record         *skydb.Record
}

Notice encapsulates the information sent to subscribers when the content of a subscription has changed.

type Notifier

type Notifier interface {
	// CanNotify returns whether the Notifier can send notice to the device.
	CanNotify(device skydb.Device) bool

	// Notify sends an notice to the device.
	Notify(device skydb.Device, notice Notice) error
}

Notifier is the interface implemented by an object that knows how to deliver a Notice to a device.

func NewHubNotifier

func NewHubNotifier(hub *pubsub.Hub) Notifier

NewHubNotifier returns an Notifier which sends Notice thru the supplied hub. The notice will be sent via the channel name "_sub_[DEVICE_ID]".

func NewMultiNotifier

func NewMultiNotifier(notifiers ...Notifier) Notifier

NewMultiNotifier returns a Notifier which sends Notice to multiple underlying Notifiers

func NewPushNotifier

func NewPushNotifier(sender push.Sender) Notifier

NewPushNotifier returns an Notifier which sends Notice using the given push.Sender.

type Service

type Service struct {
	ConnOpener func() (skydb.Conn, error)
	Notifier   Notifier
	// contains filtered or unexported fields
}

Service is responsible to send push notification to device whenever a record has been modified in db.

func (*Service) Run

func (s *Service) Run()

Run listens for Conn record event

func (*Service) Stop

func (s *Service) Stop()

Stop stops the running subscription service

Jump to

Keyboard shortcuts

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