notification

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package notification //

Package notification //

Package notification //

Package notification //

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicManager

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

AtomicManager adds handlers atomically

func NewAtomicManager

func NewAtomicManager() *AtomicManager

NewAtomicManager creates a new instance of the atomic manager

func (*AtomicManager) AddHandler

func (am *AtomicManager) AddHandler(newHandler func(interface{})) (int, error)

AddHandler adds the given handler

func (*AtomicManager) Send

func (am *AtomicManager) Send(notification interface{})

Send sends the notification to the registered handlers

type Center

type Center interface {
	AddHandler(Type, func(interface{})) (int, error)
	Send(Type, interface{}) error
}

Center handles all notification listeners. It keeps track of the Manager for each type of notification.

type DecisionNotification

type DecisionNotification struct {
	Type         DecisionNotificationType
	UserContext  entities.UserContext
	DecisionInfo map[string]interface{}
}

DecisionNotification is a notification triggered when a decision is made for either a feature or an experiment

type DecisionNotificationType

type DecisionNotificationType string

DecisionNotificationType is the type of decision notification

const (
	// Feature is used when the decision is returned as part of evaluating a feature
	Feature DecisionNotificationType = "feature"
)

type DefaultCenter

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

DefaultCenter contains all the notification managers

func NewNotificationCenter

func NewNotificationCenter() *DefaultCenter

NewNotificationCenter returns a new notification center

func (*DefaultCenter) AddHandler

func (c *DefaultCenter) AddHandler(notificationType Type, handler func(interface{})) (int, error)

AddHandler adds a handler for the given notification type

func (*DefaultCenter) Send

func (c *DefaultCenter) Send(notificationType Type, notification interface{}) error

Send sends the given notification payload to all listeners of type

type Manager

type Manager interface {
	AddHandler(func(interface{})) (int, error)
	Send(message interface{})
}

Manager is a generic interface for managing notifications of a particular type

type Type

type Type string

Type is the type of notification

const (
	// Decision notification type
	Decision Type = "decision"
)

Jump to

Keyboard shortcuts

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