notification

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package notification //

Package notification //

Package notification //

Package notification //

Index

Constants

View Source
const (
	// Decision notification type
	Decision Type = "decision"
	// Track notification type
	Track Type = "track"
	// ProjectConfigUpdate notification type
	ProjectConfigUpdate Type = "project_config_update"
	// LogEvent notification type
	LogEvent Type = "log_event_notification"

	// ABTest is used when the decision is returned as part of evaluating an ab test
	ABTest DecisionNotificationType = "ab-test"
	// Feature is used when the decision is returned as part of evaluating a feature
	Feature DecisionNotificationType = "feature"
	// FeatureTest is used when the decision is returned as part of evaluating a feature test
	FeatureTest DecisionNotificationType = "feature-test"
	// FeatureVariable is used when the decision is returned as part of evaluating a feature with a variable
	FeatureVariable DecisionNotificationType = "feature-variable"
	// AllFeatureVariables is used when the decision is returned as part of evaluating a feature with all variables
	AllFeatureVariables DecisionNotificationType = "all-feature-variables"
	// Flag is used when the decision is returned using decide api
	Flag DecisionNotificationType = "flag"
)

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(logger logging.OptimizelyLogProducer) *AtomicManager

NewAtomicManager creates a new instance of the atomic manager

func (*AtomicManager) Add

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

Add adds the given handler

func (*AtomicManager) Remove

func (am *AtomicManager) Remove(id int)

Remove removes handler with the given id

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)
	RemoveHandler(int, Type) 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

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) RemoveHandler

func (c *DefaultCenter) RemoveHandler(id int, notificationType Type) error

RemoveHandler removes a handler for the given id and 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 LogEventNotification

type LogEventNotification struct {
	Type     Type
	LogEvent interface{}
}

LogEventNotification is the notification triggered before log event is dispatched.

type Manager

type Manager interface {
	Add(func(interface{})) (int, error)
	Remove(id int)
	Send(message interface{})
}

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

type ProjectConfigUpdateNotification

type ProjectConfigUpdateNotification struct {
	Type     Type
	Revision string
}

ProjectConfigUpdateNotification is a notification triggered when a project config is updated

type TrackNotification

type TrackNotification struct {
	EventKey        string
	UserContext     entities.UserContext
	EventTags       map[string]interface{}
	ConversionEvent interface{}
}

TrackNotification is a notification triggered when track is called

type Type

type Type string

Type is the type of notification

Jump to

Keyboard shortcuts

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