data

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 5 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,omitempty"`
}

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

func (*Base) Type

func (b *Base) Type() EventType

type Condition added in v0.4.5

type Condition struct {
	Type               ConditionType   `json:"type,omitempty"`
	Status             *bool           `json:"status"`
	ExtraData          interface{}     `json:"extraData,omitempty"`
	Frequency          stats.ByWindow  `json:"frequency,omitempty"`
	LastProbeTime      *UnixMillisTime `json:"lastProbeTime"`
	LastTransitionTime *UnixMillisTime `json:"lastTransitionTime"`
}

func NewCondition added in v0.4.5

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

type ConditionType added in v0.4.5

type ConditionType string

type ErrorInfo added in v0.4.13

type ErrorInfo struct {
	Message     string `json:"message"`
	Unretriable bool   `json:"unretriable"`
}

type Event

type Event interface {
	Type() EventType
	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 EventTypeTaskResult EventType = "task_result"
const EventTypeTaskTrigger EventType = "task_trigger"
const EventTypeTranscode EventType = "transcode"
const EventTypeWebhook EventType = "webhook_event"

type ExportTaskOutput added in v0.4.13

type ExportTaskOutput struct {
	IPFS     *IPFSExportInfo `json:"ipfs,omitempty"`
	Internal interface{}     `json:"internal,omitempty"`
}

type HealthStatus added in v0.4.5

type HealthStatus struct {
	ID          string               `json:"id"`
	Healthy     *Condition           `json:"healthy"`
	Conditions  []*Condition         `json:"conditions"`
	Metrics     MetricsMap           `json:"metrics,omitempty"`
	Multistream []*MultistreamStatus `json:"multistream,omitempty"`
}

HealthStatus is a soft-immutable struct. It should never be modified inline or a lot of things could become inconsistent. Create a new instance/copy for any mutation to be performed and beware of the internal slices and pointers.

Use NewMergedStatus below to facilitate the creation of new status objects with mutated fields. Notice that you still need to clone the internal slices if you want to do any mutations to them.

func NewHealthStatus added in v0.4.5

func NewHealthStatus(id string, conditions []*Condition) *HealthStatus

func NewMergedHealthStatus added in v0.4.5

func NewMergedHealthStatus(base *HealthStatus, values HealthStatus) *HealthStatus

func (*HealthStatus) Condition added in v0.4.5

func (s *HealthStatus) Condition(typ ConditionType) *Condition

func (*HealthStatus) ConditionsCopy added in v0.4.5

func (s *HealthStatus) ConditionsCopy() []*Condition

func (*HealthStatus) MetricsCopy added in v0.4.5

func (s *HealthStatus) MetricsCopy() MetricsMap

func (*HealthStatus) MultistreamCopy added in v0.4.5

func (s *HealthStatus) MultistreamCopy() []*MultistreamStatus

type IPFSExportInfo added in v0.4.13

type IPFSExportInfo struct {
	VideoFileCID   string `json:"videoFileCid"`
	NFTMetadataCID string `json:"nftMetadataCid,omitempty"`
}

type Measure added in v0.4.5

type Measure struct {
	Timestamp time.Time
	Value     float64
}

func (Measure) MarshalJSON added in v0.4.5

func (m Measure) MarshalJSON() ([]byte, error)

func (*Measure) UnmarshalJSON added in v0.4.5

func (m *Measure) UnmarshalJSON(raw []byte) error

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 Metric added in v0.4.5

type Metric struct {
	Name       MetricName        `json:"name"`
	Dimensions map[string]string `json:"dimensions,omitempty"`
	Last       Measure           `json:"last"`
}

func NewMetric added in v0.4.5

func NewMetric(name MetricName, dimensions map[string]string, ts time.Time, value float64) *Metric

func (*Metric) Matches added in v0.4.5

func (m *Metric) Matches(name MetricName, odim map[string]string) bool

type MetricName added in v0.4.5

type MetricName string

type MetricsMap added in v0.4.5

type MetricsMap map[MetricName][]*Metric

func (MetricsMap) Add added in v0.4.5

func (m MetricsMap) Add(metric *Metric) MetricsMap

func (MetricsMap) GetMetric added in v0.4.5

func (m MetricsMap) GetMetric(name MetricName, dimensions map[string]string) *Metric

type MultistreamMetrics added in v0.3.0

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

type MultistreamStatus added in v0.4.5

type MultistreamStatus struct {
	Target    MultistreamTargetInfo `json:"target"`
	Connected *Condition            `json:"connected"`
}

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 TaskInfo added in v0.4.13

type TaskInfo struct {
	ID        string          `json:"id"`
	Type      string          `json:"type"`
	Snapshot  json.RawMessage `json:"snapshot"`
	Step      string          `json:"step"`
	StepInput json.RawMessage `json:"stepInput"`
}

type TaskOutput added in v0.4.13

type TaskOutput struct {
	Upload    *UploadTaskOutput    `json:"upload,omitempty"`
	Import    *UploadTaskOutput    `json:"import,omitempty"`
	Export    *ExportTaskOutput    `json:"export,omitempty"`
	Transcode *TranscodeTaskOutput `json:"transcode,omitempty"`
}

type TaskResultEvent added in v0.4.13

type TaskResultEvent struct {
	Base
	Task   TaskInfo    `json:"task"`
	Error  *ErrorInfo  `json:"error,omitempty"`
	Output *TaskOutput `json:"output,omitempty"`
}

func NewTaskResultEvent added in v0.4.13

func NewTaskResultEvent(info TaskInfo, err *ErrorInfo, output *TaskOutput) *TaskResultEvent

type TaskTriggerEvent added in v0.4.13

type TaskTriggerEvent struct {
	Base
	Task TaskInfo `json:"task"`
}

func NewTaskTriggerEvent added in v0.4.13

func NewTaskTriggerEvent(info TaskInfo) *TaskTriggerEvent

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 TranscodeTaskOutput added in v0.4.13

type TranscodeTaskOutput struct {
	Asset UploadTaskOutput `json:"asset,omitempty"`
}

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 UploadTaskOutput added in v0.4.21

type UploadTaskOutput struct {
	VideoFilePath    string `json:"videoFilePath"`
	MetadataFilePath string `json:"metadataFilePath"`
	// This is livepeerAPI.AssetSpec but we don't want to depend on the whole pkg
	AssetSpec interface{} `json:"assetSpec"`
}

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