events

package
v6.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package events contains the internal implementation of event forwarding.

This is an internal package; application code for specific Relay distributions should not need to reference it directly, only the core code.

Index

Constants

View Source
const (
	// SummaryEventsSchemaVersion is the minimum event schema that supports summary events
	SummaryEventsSchemaVersion = 3

	// EventSchemaHeader is an HTTP header that describes the schema version for event requests
	EventSchemaHeader = "X-LaunchDarkly-Event-Schema"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventDispatcher

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

EventDispatcher relays events to LaunchDarkly for an environment

func NewEventDispatcher

func NewEventDispatcher(
	sdkKey c.SDKKey,
	mobileKey c.MobileKey,
	envID c.EnvironmentID,
	loggers ldlog.Loggers,
	config c.EventsConfig,
	httpConfig httpconfig.HTTPConfig,
	storeAdapter *store.SSERelayDataStoreAdapter,
) *EventDispatcher

NewEventDispatcher creates a handler for relaying events to LaunchDarkly for an environment

func (*EventDispatcher) Close

func (r *EventDispatcher) Close()

Close shuts down any goroutines/channels being used by the EventDispatcher.

func (*EventDispatcher) GetHandler

func (r *EventDispatcher) GetHandler(sdkKind basictypes.SDKKind, eventsKind ldevents.EventDataKind) func(w http.ResponseWriter, req *http.Request)

GetHandler returns the HTTP handler for an endpoint, or nil if none is defined

func (*EventDispatcher) ReplaceCredential

func (r *EventDispatcher) ReplaceCredential(newCredential c.SDKCredential)

ReplaceCredential changes the authorization credentail that is used when forwarding events to any endpoints that use that type of credential. For instance, if newCredential is a MobileKey, this affects only endpoints that use a mobile key.

type EventPublisher

type EventPublisher interface {
	// Publish adds any number of JSON elements to the queue.
	Publish(...json.RawMessage)

	// Flush attempts to deliver all queued events.
	Flush()

	// ReplaceCredential changes the authorization credential used when sending events, if the previous
	// credential was of the same type.
	ReplaceCredential(config.SDKCredential)

	// Close releases all resources used by this object.
	Close()
}

EventPublisher is the interface for queueing and flushing proxied events.

type HTTPEventPublisher

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

HTTPEventPublisher is the standard implementation of EventPublisher.

func NewHTTPEventPublisher

func NewHTTPEventPublisher(authKey config.SDKCredential, httpConfig httpconfig.HTTPConfig, loggers ldlog.Loggers, options ...OptionType) (*HTTPEventPublisher, error)

NewHTTPEventPublisher creates a new HTTPEventPublisher.

func (*HTTPEventPublisher) Close

func (p *HTTPEventPublisher) Close()

func (*HTTPEventPublisher) Flush

func (p *HTTPEventPublisher) Flush()

func (*HTTPEventPublisher) Publish

func (p *HTTPEventPublisher) Publish(events ...json.RawMessage)

func (*HTTPEventPublisher) ReplaceCredential

func (p *HTTPEventPublisher) ReplaceCredential(newCredential config.SDKCredential)

type OptionCapacity

type OptionCapacity int

OptionCapacity specifies the event queue capacity.

type OptionEndpointURI

type OptionEndpointURI string

OptionEndpointURI specifies a complete custom URI for the events service (not a base URI).

type OptionFlushInterval

type OptionFlushInterval time.Duration

OptionFlushInterval specifies the interval for automatic flushes.

type OptionType

type OptionType interface {
	// contains filtered or unexported methods
}

OptionType defines optional parameters for NewHTTPEventPublisher.

type OptionURI

type OptionURI string

OptionURI specifies a custom base URI for the events service.

Jump to

Keyboard shortcuts

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