eventstream

package
Version: v0.0.0-...-a69e935 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the event stream client

func NewEventStreamClient

func NewEventStreamClient(
	d *yarpc.Dispatcher,
	clientName string,
	server string,
	taskUpdateHandler EventHandler,
	parentScope tally.Scope,
) *Client

NewEventStreamClient creates a client that consumes from remote event stream handler

func (*Client) Start

func (c *Client) Start()

Start starts the client.

func (*Client) Stop

func (c *Client) Stop()

Stop stops the client.

type ClientMetrics

type ClientMetrics struct {
	EventsConsumed tally.Counter
	StreamIDChange tally.Counter
	PurgeOffset    tally.Gauge

	InitStreamAPI        tally.Counter
	InitStreamSuccess    tally.Counter
	InitStreamFail       tally.Counter
	WaitForEventsAPI     tally.Counter
	WaitForEventsSuccess tally.Counter
	WaitForEventsFailed  tally.Counter
}

ClientMetrics is the metrics for event stream client

func NewClientMetrics

func NewClientMetrics(scope tally.Scope) *ClientMetrics

NewClientMetrics creates a new ClientMetrics

type EventHandler

type EventHandler interface {
	// The event notification callback
	OnV1Event(event *pbevent.Event)

	// The events notification callback
	OnV1Events(events []*pbevent.Event)

	// Returns the event progress the handler has processed. The value
	// will be used by the client to determine the purgeOffset
	GetEventProgress() uint64
}

EventHandler is the interface for handling task update events

type Handler

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

Handler holds a circular buffer and serves request to pull data. This component is used in hostmgr and resmgr.

func NewEventStreamHandler

func NewEventStreamHandler(
	bufferSize int,
	expectedClients []string,
	purgedEventsProcessor PurgedEventsProcessor,
	parentScope tally.Scope,
) *Handler

NewEventStreamHandler creates an EventStreamHandler.

func NewTestHandler

func NewTestHandler() *Handler

NewTestHandler returns an empty new Handler ptr for testing.

func (*Handler) AddEvent

func (h *Handler) AddEvent(e *pbevent.Event) error

AddEvent adds a task Event or mesos status update into the inner circular buffer.

func (*Handler) GetEvents

func (h *Handler) GetEvents() ([]*pbevent.Event, error)

GetEvents returns all the events pending in circular buffer This method is primarily for debugging purpose

func (*Handler) InitStream

InitStream handles the initstream request.

func (*Handler) WaitForEvents

WaitForEvents handles the WaitForEvents request.

type HandlerMetrics

type HandlerMetrics struct {
	Head     tally.Gauge
	Tail     tally.Gauge
	Size     tally.Gauge
	Capacity tally.Gauge

	UnexpectedClientError tally.Counter
	PurgeEventError       tally.Counter
	InvalidStreamIDError  tally.Counter

	AddEventAPI          tally.Counter
	AddEventSuccess      tally.Counter
	AddEventDeDupe       tally.Counter
	AddEventFail         tally.Counter
	InitStreamAPI        tally.Counter
	InitStreamSuccess    tally.Counter
	InitStreamFail       tally.Counter
	WaitForEventsAPI     tally.Counter
	WaitForEventsSuccess tally.Counter
	WaitForEventsFailed  tally.Counter
}

HandlerMetrics is the metrics for event stream handler

func NewHandlerMetrics

func NewHandlerMetrics(scope tally.Scope) *HandlerMetrics

NewHandlerMetrics creates a HandlerMetrics

type PurgedEventsProcessor

type PurgedEventsProcessor interface {
	EventPurged(events []*cirbuf.CircularBufferItem)
}

PurgedEventsProcessor is the interface to handle the purged data.

Jump to

Keyboard shortcuts

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