event

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package event //

Package event //

Package event //

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIManager

type APIManager interface {
	// not passing ODPConfig here to avoid multiple mutex lock calls inside the batch events loop
	SendOdpEvents(apiKey, apiHost string, events []Event) (canRetry bool, err error)
}

APIManager represents the event API manager.

type BatchEventManager

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

BatchEventManager represents default implementation of BatchEventManager

func NewBatchEventManager

func NewBatchEventManager(options ...EMOptionFunc) *BatchEventManager

NewBatchEventManager returns a new instance of BatchEventManager with options

func (*BatchEventManager) FlushEvents

func (bm *BatchEventManager) FlushEvents(apiKey, apiHost string)

FlushEvents flushes events in queue

func (*BatchEventManager) IdentifyUser

func (bm *BatchEventManager) IdentifyUser(apiKey, apiHost, userID string)

IdentifyUser associates a full-stack userid with an established VUID

func (*BatchEventManager) IsOdpServiceIntegrated

func (bm *BatchEventManager) IsOdpServiceIntegrated(apiKey, apiHost string) bool

IsOdpServiceIntegrated returns true if odp service is integrated

func (*BatchEventManager) ProcessEvent

func (bm *BatchEventManager) ProcessEvent(apiKey, apiHost string, odpEvent Event) (err error)

ProcessEvent takes the given odp event and queues it up to be dispatched. A dispatch happens when we flush the events, which can happen on a set interval or when the specified batch size is reached.

func (*BatchEventManager) Start

func (bm *BatchEventManager) Start(ctx context.Context, odpConfig config.Config)

Start does not do any initialization, just starts the ticker odpConfig is required here since it can be updated anytime and ticker needs to be aware of latest changes

type DefaultEventAPIManager

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

DefaultEventAPIManager represents default implementation of Event API Manager

func NewEventAPIManager

func NewEventAPIManager(sdkKey string, requester pkgUtils.Requester) *DefaultEventAPIManager

NewEventAPIManager creates and returns a new instance of DefaultEventAPIManager.

func (*DefaultEventAPIManager) SendOdpEvents

func (s *DefaultEventAPIManager) SendOdpEvents(apiKey, apiHost string, events []Event) (canRetry bool, err error)

SendOdpEvents sends events to ODP's RESTful API

type EMOptionFunc

type EMOptionFunc func(em *BatchEventManager)

EMOptionFunc are the EventManager options that give you the ability to add one more more options before the event manager is initialized.

func WithAPIManager

func WithAPIManager(apiManager APIManager) EMOptionFunc

WithAPIManager sets apiManager as a config option to be passed into the NewBatchEventManager method

func WithFlushInterval

func WithFlushInterval(flushInterval time.Duration) EMOptionFunc

WithFlushInterval sets the flush interval as a config option to be passed into the NewBatchEventManager method default value is 1 second

func WithQueue

func WithQueue(q event.Queue) EMOptionFunc

WithQueue sets the Queue as a config option to be passed into the NewBatchEventManager method

func WithQueueSize

func WithQueueSize(qsize int) EMOptionFunc

WithQueueSize sets the queue size as a config option to be passed into the NewBatchEventManager method default value is 10000

func WithSDKKey

func WithSDKKey(sdkKey string) EMOptionFunc

WithSDKKey sets the SDKKey used for logging

type Event

type Event struct {
	Type        string                 `json:"type"`
	Action      string                 `json:"action"`
	Identifiers map[string]string      `json:"identifiers"`
	Data        map[string]interface{} `json:"data"`
}

Event represents a event to be sent and stored in the Optimizely Data Platform

type Manager

type Manager interface {
	// odpConfig is required here since it can be updated anytime and ticker needs to be aware of latest changes
	Start(ctx context.Context, odpConfig config.Config)
	IdentifyUser(apiKey, apiHost, userID string)
	ProcessEvent(apiKey, apiHost string, odpEvent Event) error
	FlushEvents(apiKey, apiHost string)
}

Manager represents the event manager.

Jump to

Keyboard shortcuts

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