data

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Type       EventType      `json:"type"`
	ID_        uuid.UUID      `json:"id"`
	Timestamp_ UnixMillisTime `json:"timestamp"`
	StreamID_  string         `json:"streamId"`
}

func (*Base) ID

func (b *Base) ID() uuid.UUID

func (*Base) StreamID added in v0.2.0

func (b *Base) StreamID() string

func (*Base) Timestamp

func (b *Base) Timestamp() time.Time

type Event

type Event interface {
	ID() uuid.UUID
	Timestamp() time.Time
	StreamID() string
}

TODO: Call these just Message for consistency with livepeer-com

func ParseEvent

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

type EventType

type EventType string
const EventTypeMediaServerMetrics EventType = "media_server_metrics"
const EventTypeStreamState EventType = "stream_state"
const EventTypeTranscode EventType = "transcode"
const EventTypeWebhook EventType = "webhook_event"

type MediaServerMetricsEvent added in v0.3.0

type MediaServerMetricsEvent struct {
	Base
	NodeID      string                      `json:"nodeId"`
	Region      string                      `json:"region,omitempty"`
	Stats       *StreamMetrics              `json:"stats"`
	Multistream []*MultistreamTargetMetrics `json:"multistream"`
}

func NewMediaServerMetricsEvent added in v0.3.0

func NewMediaServerMetricsEvent(nodeID, region, streamID string, stats *StreamMetrics, multistream []*MultistreamTargetMetrics) *MediaServerMetricsEvent

type MultistreamMetrics added in v0.3.0

type MultistreamMetrics struct {
	ActiveSec   int64 `json:"activeSec"`
	Bytes       int64 `json:"bytes"`
	MediaTimeMs int64 `json:"mediaTimeMs"`
}

type MultistreamTargetInfo added in v0.2.0

type MultistreamTargetInfo struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Profile string `json:"profile"`
}

type MultistreamTargetMetrics added in v0.3.0

type MultistreamTargetMetrics struct {
	Target  MultistreamTargetInfo `json:"target"`
	Metrics *MultistreamMetrics   `json:"metrics"`
}

type MultistreamWebhookPayload added in v0.2.0

type MultistreamWebhookPayload struct {
	Target MultistreamTargetInfo `json:"target"`
}

type OrchestratorMetadata

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

type SegmentMetadata

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

type StreamMetrics added in v0.3.0

type StreamMetrics struct {
	MediaTimeMs *int64 `json:"mediaTimeMs"`
}

type StreamState added in v0.4.0

type StreamState struct {
	Active bool `json:"active"`
}

type StreamStateEvent added in v0.4.0

type StreamStateEvent struct {
	Base
	NodeID string      `json:"nodeId"`
	Region string      `json:"region,omitempty"`
	UserID string      `json:"userId"`
	State  StreamState `json:"state"`
}

func NewStreamStateEvent added in v0.4.0

func NewStreamStateEvent(nodeID, region, userID, streamID string, state StreamState) *StreamStateEvent

type TranscodeAttemptInfo

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

type TranscodeEvent

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

func NewTranscodeEvent

func NewTranscodeEvent(nodeID, streamID string, seg SegmentMetadata, startTime time.Time, success bool, attempts []TranscodeAttemptInfo) *TranscodeEvent

type UnixMillisTime added in v0.2.0

type UnixMillisTime struct{ time.Time }

func NewUnixMillisTime added in v0.2.0

func NewUnixMillisTime(unixMillis int64) UnixMillisTime

func (UnixMillisTime) MarshalJSON added in v0.2.0

func (u UnixMillisTime) MarshalJSON() ([]byte, error)

func (UnixMillisTime) UnixMillis added in v0.2.0

func (u UnixMillisTime) UnixMillis() int64

func (*UnixMillisTime) UnmarshalJSON added in v0.2.0

func (u *UnixMillisTime) UnmarshalJSON(data []byte) error

type WebhookEvent added in v0.2.0

type WebhookEvent struct {
	Base
	Event     string          `json:"event"`
	UserID    string          `json:"userId"`
	SessionID string          `json:"sessionId,omitempty"`
	Payload   json.RawMessage `json:"payload,omitempty"`
}

func NewWebhookEvent added in v0.2.0

func NewWebhookEvent(streamID, event, userID, sessionID string, payload interface{}) (*WebhookEvent, error)

Jump to

Keyboard shortcuts

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