health

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Type               ConditionType  `json:"type,omitempty"`
	Status             *bool          `json:"status"`
	Frequency          stats.ByWindow `json:"frequency,omitempty"`
	LastProbeTime      *time.Time     `json:"lastProbeTime"`
	LastTransitionTime *time.Time     `json:"lastTransitionsTime"`
}

func NewCondition

func NewCondition(condType ConditionType, ts time.Time, status *bool, frequency stats.ByWindow, last *Condition) *Condition

type ConditionType

type ConditionType string

type Core

type Core struct {
	RecordStorage
	// contains filtered or unexported fields
}

func NewCore

func NewCore(opts CoreOptions, consumer event.StreamConsumer) *Core

func (*Core) HandleMessage

func (c *Core) HandleMessage(msg event.StreamMessage)

func (*Core) Start

func (c *Core) Start(ctx context.Context) error

func (*Core) Use

func (c *Core) Use(reducers ...Reducer) *Core

type CoreOptions

type CoreOptions struct {
	Streaming       StreamingOptions
	StartTimeOffset time.Duration
}

type Event

type Event interface {
	ManifestID() string
	Timestamp() time.Time
}

func ParseEvent

func ParseEvent(data []byte) (Event, error)

type OrchestratorMetadata

type OrchestratorMetadata struct {
	Address       string `json:"address"`
	TranscoderUri string `json:"transcodeUri"`
}

type Record

type Record struct {
	ID         string
	Conditions []ConditionType

	PastEvents []Event

	ReducersState map[int]interface{}
	LastStatus    Status
}

func NewRecord

func NewRecord(id string, conditions []ConditionType) *Record

type RecordStorage

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

func (*RecordStorage) Get

func (s *RecordStorage) Get(id string) (*Record, bool)

func (*RecordStorage) GetOrCreate

func (s *RecordStorage) GetOrCreate(id string, conditions []ConditionType) *Record

type Reducer

type Reducer interface {
	Bindings(golpExchange string) []event.BindingArgs
	Conditions() []ConditionType
	Reduce(current Status, state interface{}, evt Event) (Status, interface{})
}

type ReducerFunc

type ReducerFunc func(Status, interface{}, Event) (Status, interface{})

func (ReducerFunc) Bindings

func (f ReducerFunc) Bindings(_ string) []event.BindingArgs

func (ReducerFunc) Conditions

func (f ReducerFunc) Conditions() []ConditionType

func (ReducerFunc) Reduce

func (f ReducerFunc) Reduce(current Status, state interface{}, evt Event) (Status, interface{})

type SegmentMetadata

type SegmentMetadata struct {
	Name     string  `json:"name"`
	SeqNo    uint64  `json:"seqNo"`
	Duration float64 `json:"duration"`
}

type Status

type Status struct {
	ID         string       `json:"id"`
	Healthy    Condition    `json:"healthy"`
	Conditions []*Condition `json:"conditions"`
}

func (Status) GetCondition

func (s Status) GetCondition(condType ConditionType) *Condition

type StreamingOptions

type StreamingOptions struct {
	Stream, Exchange string
	ConsumerName     string

	event.RawStreamOptions
}

Purposedly made of built-in types only to bind directly to cli flags.

type TranscodeAttemptInfo

type TranscodeAttemptInfo struct {
	Orchestrator OrchestratorMetadata `json:"orchestrator"`
	LatencyMs    int64                `json:"latencyMs"`
	Error        *string              `json:"error"`
}

type TranscodeEvent

type TranscodeEvent struct {
	NodeID      string                 `json:"nodeId"`
	ManifestID_ string                 `json:"manifestId"`
	Segment     SegmentMetadata        `json:"segment"`
	StartTime   int64                  `json:"startTime"`
	LatencyMs   int64                  `json:"latencyMs"`
	Success     bool                   `json:"success"`
	Attempts    []TranscodeAttemptInfo `json:"attempts"`
}

func (*TranscodeEvent) ManifestID

func (e *TranscodeEvent) ManifestID() string

func (*TranscodeEvent) Timestamp

func (e *TranscodeEvent) Timestamp() time.Time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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