common

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallDefaultControlNodeConfigValues

func InstallDefaultControlNodeConfigValues()

InstallDefaultControlNodeConfigValues installs default config parameters in viper for control node

func InstallDefaultEdgeNodeConfigValues

func InstallDefaultEdgeNodeConfigValues()

InstallDefaultEdgeNodeConfigValues installs default config parameters in viper for edge node

Types

type APIConfig

type APIConfig struct {
	// Endpoint sets API endpoint related parameters
	Endpoint EndpointConfig `mapstructure:"endPoint" json:"endPoint" validate:"required,dive"`
	// RequestLogging sets API request logging parameters
	RequestLogging HTTPRequestLogging `mapstructure:"requestLogging" json:"requestLogging" validate:"required,dive"`
}

APIConfig defines API settings for a submodule

type APIServerConfig

type APIServerConfig struct {
	// Enabled whether this API is enabled
	Enabled bool `mapstructure:"enabled" json:"enabled"`
	// Server defines HTTP server parameters
	Server HTTPServerConfig `mapstructure:"service" json:"service" validate:"required_with=Enabled,dive"`
	// APIs defines API settings for a submodule
	APIs APIConfig `mapstructure:"apis" json:"apis" validate:"required_with=Enabled,dive"`
}

APIServerConfig defines HTTP API / server parameters

type BroadcastSystemConfig

type BroadcastSystemConfig struct {
	// PubSub broadcast PubSub settings
	PubSub PubSubSubcriptionConfig `mapstructure:"pubsub" json:"pubsub" validate:"required,dive"`
}

BroadcastSystemConfig system broadcast channel configuration

type CentralVODServerConfig

type CentralVODServerConfig struct {
	VODServerConfig `mapstructure:",squash"`
	// APIServer HLS VOD REST API server config
	APIServer APIServerConfig `mapstructure:"api" json:"api" validate:"required,dive"`
	// Cache memcached based video segment cache
	Cache MemcachedSegementCacheConfig `mapstructure:"cache" json:"cache" validate:"required,dive"`
	// SegReceiverTrackingWindowInSec Tracking window is the duration in time a video segment is
	// tracked. Recorded segments are forgotten after this tracking window.
	SegReceiverTrackingWindowInSec uint32 `mapstructure:"segmentReceiverTrackingWindow" json:"segmentReceiverTrackingWindow" validate:"gte=10,lte=300"`
	// RecordingStorage video recording storage config
	RecordingStorage RecordingStorageConfig `mapstructure:"recordingStorage" json:"recordingStorage" validate:"required,dive"`
	// SegmentReaderWorkerCount number of worker threads in the video segment reader
	SegmentReaderWorkerCount int `mapstructure:"segmentReaderWorkerCount" json:"segmentReaderWorkerCount" validate:"gte=2,lte=64"`
}

CentralVODServerConfig VOD server running on the control node

func (CentralVODServerConfig) SegReceiverTrackingWindow

func (c CentralVODServerConfig) SegReceiverTrackingWindow() time.Duration

SegReceiverTrackingWindow convert SegReceiverTrackingWindowInSec to time.Duration

type ControlNodeConfig

type ControlNodeConfig struct {
	// Metrics metrics framework configuration
	Metrics MetricsConfig `mapstructure:"metrics" json:"metrics" validate:"required,dive"`
	// Postgres postgres DB configuration
	Postgres PostgresConfig `mapstructure:"postgres" json:"postgres" validate:"required,dive"`
	// Management management
	Management SystemManagementConfig `mapstructure:"management" json:"management" validate:"required,dive"`
	// VODConfig control node VOD server config
	VODConfig CentralVODServerConfig `mapstructure:"vod" json:"vod" validate:"required,dive"`
	// BroadcastSystem system broadcast channel configuration
	BroadcastSystem BroadcastSystemConfig `mapstructure:"broadcast" json:"broadcast" validate:"required,dive"`
}

ControlNodeConfig define control node settings and behavior

type EdgeNodeConfig

type EdgeNodeConfig struct {
	// Metrics metrics framework configuration
	Metrics MetricsConfig `mapstructure:"metrics" json:"metrics" validate:"required,dive"`
	// VideoSource the video source this edge is monitoring
	VideoSource VideoSourceConfig `mapstructure:"videoSource" json:"videoSource" validate:"required,dive"`
	// SegmentCache video segment cache config
	SegmentCache RAMSegmentCacheConfig `mapstructure:"cache" json:"cache" validate:"required,dive"`
	// Sqlite sqlite DB configuration
	Sqlite SqliteConfig `mapstructure:"sqlite" json:"sqlite" validate:"required,dive"`
	// MonitorConfig HLS video source monitoring config
	MonitorConfig HLSMonitorConfig `mapstructure:"monitor" json:"monitor" validate:"required,dive"`
	// Forwarder video segment forwarding config
	Forwarder VideoForwarderConfig `mapstructure:"forwarder" json:"forwarder" validate:"required,dive"`
	// VODConfig HLS VOD server config
	VODConfig VODServerConfig `mapstructure:"vod" json:"vod" validate:"required,dive"`
	// APIServer local REST API config
	APIServer APIServerConfig `mapstructure:"api" json:"api" validate:"required,dive"`
	// RRClient PubSub request-response client config
	RRClient EdgeReqRespClientConfig `mapstructure:"requestResponse" json:"requestResponse" validate:"required,dive"`
	// BroadcastSystem system broadcast channel configuration
	BroadcastSystem BroadcastSystemConfig `mapstructure:"broadcast" json:"broadcast" validate:"required,dive"`
}

EdgeNodeConfig define edge node settings and behavior

type EdgeReqRespClientConfig

type EdgeReqRespClientConfig struct {
	ReqRespClientConfig `mapstructure:",squash"`
	// ControlRRTopic the PubSub topic for reaching system control
	ControlRRTopic string `mapstructure:"systemControlTopic" json:"systemControlTopic" validate:"required"`
}

EdgeReqRespClientConfig PubSub request-response client config for edge-to-control requests

type EndpointConfig

type EndpointConfig struct {
	// PathPrefix is the end-point path prefix for the APIs
	PathPrefix string `mapstructure:"pathPrefix" json:"pathPrefix" validate:"required"`
}

EndpointConfig defines API endpoint config

type HLSMonitorConfig

type HLSMonitorConfig struct {
	// DefaultSegmentURIPrefix optionally set default video segment URI prefix
	DefaultSegmentURIPrefix *string `mapstructure:"defaultSegmentURIPrefix,omitempty" json:"defaultSegmentURIPrefix,omitempty" validate:"omitempty,uri"`
	// TrackingWindowInSec tracking window is the duration in time a video segment is tracked.
	// After observing a new segment, that segment is remembered for the duration of a
	// tracking window, and forgotten after that.
	TrackingWindowInSec uint32 `mapstructure:"trackingWindow" json:"trackingWindow" validate:"gte=10,lte=300"`
	// SegmentReaderWorkerCount number of worker threads in the video segment reader
	SegmentReaderWorkerCount int `mapstructure:"segmentReaderWorkerCount" json:"segmentReaderWorkerCount" validate:"gte=2,lte=64"`
}

HLSMonitorConfig HLS video source monitoring config

func (HLSMonitorConfig) TrackingWindow

func (c HLSMonitorConfig) TrackingWindow() time.Duration

TrackingWindow convert TrackingWindowInSec to time.Duration

type HTTPClientAuthConfig

type HTTPClientAuthConfig struct {
	// IssuerURL OpenID provider issuer URL
	IssuerURL string `mapstructure:"issuerURL" json:"issuerURL" validate:"required,url"`
	// ClientID OAuth client ID
	ClientID string `json:"clientID" validate:"required"`
	// ClientSecret OAuth client secret
	ClientSecret string `json:"clientSecret" validate:"required"`
	// TargetAudience target audience `aud` to acquire a token for
	TargetAudience string `mapstructure:"targetAudience" json:"targetAudience" validate:"required,url"`
}

HTTPClientAuthConfig HTTP client OAuth middleware configuration

Currently only support client-credential OAuth flow configuration

type HTTPClientConfig

type HTTPClientConfig struct {
	// OAuth OAuth middleware integration configuration
	OAuth *HTTPClientAuthConfig `mapstructure:"oauth,omitempty" json:"oauth,omitempty" validate:"omitempty,dive"`
	// Retry client retry configuration. See https://github.com/go-resty/resty#retries for details
	Retry HTTPClientRetryConfig `mapstructure:"retry" json:"retry" validate:"required,dive"`
}

HTTPClientConfig HTTP client config targeting `go-resty`

type HTTPClientRetryConfig

type HTTPClientRetryConfig struct {
	// MaxAttempts max number of retry attempts
	MaxAttempts int `mapstructure:"maxAttempts" json:"maxAttempts" validate:"gte=0"`
	// InitWaitTimeInSec wait time before the first wait retry
	InitWaitTimeInSec uint32 `mapstructure:"initialWaitTimeInSec" json:"initialWaitTimeInSec" validate:"gte=1"`
	// MaxWaitTimeInSec max wait time
	MaxWaitTimeInSec uint32 `mapstructure:"maxWaitTimeInSec" json:"maxWaitTimeInSec" validate:"gte=1"`
}

HTTPClientRetryConfig HTTP client config retry configuration

func (HTTPClientRetryConfig) InitWaitTime

func (c HTTPClientRetryConfig) InitWaitTime() time.Duration

InitWaitTime convert InitWaitTimeInSec to time.Duration

func (HTTPClientRetryConfig) MaxWaitTime

func (c HTTPClientRetryConfig) MaxWaitTime() time.Duration

MaxWaitTime convert MaxWaitTimeInSec to time.Duration

type HTTPForwarderTargetConfig

type HTTPForwarderTargetConfig struct {
	// TargetURL URL to send new segments to
	TargetURL string `mapstructure:"targetURL" json:"targetURL" validate:"required,url"`
	// RequestIDHeader request ID header name to set when forwarding
	RequestIDHeader string `mapstructure:"requestIDHeader" json:"requestIDHeader" validate:"required"`
	// Client HTTP client config. This is designed to support `go-resty`
	Client HTTPClientConfig `mapstructure:"client" json:"client" validate:"required,dive"`
}

HTTPForwarderTargetConfig HTTP video forwarder target config

type HTTPRequestLogging

type HTTPRequestLogging struct {
	// LogLevel output request logs at this level
	LogLevel goutils.HTTPRequestLogLevel `mapstructure:"logLevel" json:"logLevel" validate:"oneof=warn info debug"`
	// HealthLogLevel output health check logs at this level
	HealthLogLevel goutils.HTTPRequestLogLevel `mapstructure:"healthLogLevel" json:"healthLogLevel" validate:"oneof=warn info debug"`
	// RequestIDHeader is the HTTP header containing the API request ID
	RequestIDHeader string `mapstructure:"requestIDHeader" json:"requestIDHeader"`
	// DoNotLogHeaders is the list of headers to not include in logging metadata
	DoNotLogHeaders []string `mapstructure:"skipHeaders" json:"skipHeaders"`
}

HTTPRequestLogging defines HTTP request logging parameters

type HTTPServerConfig

type HTTPServerConfig struct {
	// ListenOn is the interface the HTTP server will listen on
	ListenOn string `mapstructure:"listenOn" json:"listenOn" validate:"required,ip"`
	// Port is the port the HTTP server will listen on
	Port uint16 `mapstructure:"appPort" json:"appPort" validate:"required,gt=0,lt=65536"`
	// Timeouts sets the HTTP timeout settings
	Timeouts HTTPServerTimeoutConfig `mapstructure:"timeoutSecs" json:"timeoutSecs" validate:"required,dive"`
}

HTTPServerConfig defines the HTTP server parameters

type HTTPServerTimeoutConfig

type HTTPServerTimeoutConfig struct {
	// ReadTimeout is the maximum duration for reading the entire
	// request, including the body in seconds. A zero or negative
	// value means there will be no timeout.
	ReadTimeout int `mapstructure:"read" json:"read" validate:"gte=0"`
	// WriteTimeout is the maximum duration before timing out
	// writes of the response in seconds. A zero or negative value
	// means there will be no timeout.
	WriteTimeout int `mapstructure:"write" json:"write" validate:"gte=0"`
	// IdleTimeout is the maximum amount of time to wait for the
	// next request when keep-alives are enabled in seconds. If
	// IdleTimeout is zero, the value of ReadTimeout is used. If
	// both are zero, there is no timeout.
	IdleTimeout int `mapstructure:"idle" json:"idle" validate:"gte=0"`
}

HTTPServerTimeoutConfig defines the timeout settings for HTTP server

type LiveStreamVideoForwarderConfig

type LiveStreamVideoForwarderConfig struct {
	// MaxInFlight max number of segments to forward in parallel
	MaxInFlight int `mapstructure:"maxInFlightSegments" json:"maxInFlightSegments" validate:"required,gte=1"`
	// Remote HTTP forwarder target config
	Remote HTTPForwarderTargetConfig `mapstructure:"remote" json:"remote" validate:"required,dive"`
}

LiveStreamVideoForwarderConfig HTTP video forward supporting live stream through control node

type MemcachedSegementCacheConfig

type MemcachedSegementCacheConfig struct {
	// Servers list of memcached servers to establish connection with
	Servers []string `mapstructure:"servers" json:"servers" validate:"required,gte=1"`
}

MemcachedSegementCacheConfig memcached video segment cache config

type MetricsConfig

type MetricsConfig struct {
	// Server defines HTTP server parameters
	Server HTTPServerConfig `mapstructure:"service" json:"service" validate:"required_with=Enabled,dive"`
	// MetricsEndpoint path to host the Prometheus metrics endpoint
	MetricsEndpoint string `mapstructure:"metricsEndpoint" json:"metricsEndpoint" validate:"required"`
	// MaxRequests max number of metrics requests in parallel to support
	MaxRequests int `mapstructure:"maxRequests" json:"maxRequests" validate:"gte=1"`
	// Features metrics framework features to enable
	Features MetricsFeatureConfig `mapstructure:"features" json:"features" validate:"gte=1"`
}

MetricsConfig application metrics config

type MetricsFeatureConfig

type MetricsFeatureConfig struct {
	// EnableAppMetrics whether to enable Golang application metrics
	EnableAppMetrics bool `mapstructure:"enableAppMetrics" json:"enableAppMetrics"`
	// EnableHTTPMetrics whether to enable HTTP request tracking metrics
	EnableHTTPMetrics bool `mapstructure:"enableHTTPMetrics" json:"enableHTTPMetrics"`
	// EnablePubSubMetrics whether to enable PubSub operational metrics
	EnablePubSubMetrics bool `mapstructure:"enablePubSubMetrics" json:"enablePubSubMetrics"`
}

MetricsFeatureConfig metrics framework features config

type PostgresConfig

type PostgresConfig struct {
	// Host Postgres server host
	Host string `mapstructure:"host" json:"host" validate:"required"`
	// Port Postgres server port
	Port uint16 `mapstructure:"port" json:"port" validate:"lte=65535,gte=0"`
	// Database the specific database to use
	Database string `mapstructure:"db" json:"db" validate:"required"`
	// User the user to connect with
	User string `mapstructure:"user" json:"user" validate:"required"`
	// SSL the connection SSL settings
	SSL PostgresSSLConfig `mapstructure:"ssl" json:"ssl" validate:"required,dive"`
}

PostgresConfig Postgres connection config

type PostgresSSLConfig

type PostgresSSLConfig struct {
	// Enabled whether to enable SSL when connecting to Postgres
	Enabled bool `mapstructure:"enabled" json:"enabled"`
	// CAFile the CA cert file to challenge remote with
	CAFile *string `mapstructure:"caFile" json:"caFile,omitempty" validate:"omitempty,file"`
}

PostgresSSLConfig Postgres connection SSL config

type PubSubSubcriptionConfig

type PubSubSubcriptionConfig struct {
	// Topic the pubsub topic to subscribe to
	Topic string `mapstructure:"topic" json:"topic" validate:"required"`
	// MsgTTLInSec message retention within the subscription in secs
	MsgTTLInSec uint32 `mapstructure:"msgTTL" json:"msgTTL" validate:"gte=600,lte=604800"`
}

PubSubSubcriptionConfig PubSub subscription config

func (PubSubSubcriptionConfig) MsgTTL

MsgTTL convert MsgTTLInSec to time.Duration

type RAMSegmentCacheConfig

type RAMSegmentCacheConfig struct {
	// RetentionCheckIntInSec cache entry retention check interval in secs
	RetentionCheckIntInSec uint32 `mapstructure:"retentionCheckIntInSec" json:"retentionCheckIntInSec" validate:"gte=10,lte=300"`
}

RAMSegmentCacheConfig in-memory video segment cache config

func (RAMSegmentCacheConfig) RetentionCheckInt

func (c RAMSegmentCacheConfig) RetentionCheckInt() time.Duration

RetentionCheckInt convert RetentionCheckIntInSec to time.Duration

type Recording

type Recording struct {
	// ID video recording session ID
	ID string `json:"id" gorm:"column:id;primaryKey" validate:"required"`
	// Alias an optional alias name for the recording session
	Alias *string `json:"alias,omitempty" gorm:"column:alias;default:null"`
	// Description an optional description of the recording session
	Description *string `json:"description,omitempty" gorm:"column:description;default:null"`
	// SourceID ID of the video source this recording session belongs to
	SourceID string `json:"source" gorm:"column:source;not null;index:recording_source_index" validate:"required"`
	// StartTime when the recording session started
	StartTime time.Time `json:"start_ts" validate:"required" gorm:"column:start_ts;not null;index:recording_time_index"`
	// EndTime when the recording session ended
	EndTime time.Time `json:"end_ts" validate:"omitempty" gorm:"column:end_ts;default:null"`
	// Active whether the video recording session is active
	Active    int       `json:"active" gorm:"column:active;default:-1" validate:"oneof=-1 1"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Recording represents a video recording session

type RecordingManagementConfig

type RecordingManagementConfig struct {
	// SegmentCleanupIntInSec The number of seconds between recording segment cleanup runs.
	// During each run, recording segments not associated with any recordings are purged.
	SegmentCleanupIntInSec uint32 `mapstructure:"segmentCleanupIntInSec" json:"segmentCleanupIntInSec" validate:"required,gte=60"`
}

RecordingManagementConfig recording session management settings

func (RecordingManagementConfig) SegmentCleanupInt

func (c RecordingManagementConfig) SegmentCleanupInt() time.Duration

SegmentCleanupInt convert SegmentCleanupIntInSec ti time.Duration

type RecordingStorageConfig

type RecordingStorageConfig struct {
	// S3 object store config
	S3 S3Config `mapstructure:"s3" json:"s3" validate:"required,dive"`
	// StorageBucket the storage bucket to place all the recording video segments in
	StorageBucket string `mapstructure:"bucket" json:"bucket" validate:"required"`
	// StorageObjectPrefix the prefix used when defining the object key to store a segment with
	StorageObjectPrefix string `mapstructure:"objectPrefix" json:"objectPrefix" validate:"required"`
}

RecordingStorageConfig video recording storage config

type RecordingVideoForwarderConfig

type RecordingVideoForwarderConfig struct {
	// MaxInFlight max number of segments to forward in parallel
	MaxInFlight int `mapstructure:"maxInFlightSegments" json:"maxInFlightSegments" validate:"required,gte=1"`
	// RecordingStorage video recording storage config
	RecordingStorage RecordingStorageConfig `mapstructure:"storage" json:"storage" validate:"required,dive"`
}

RecordingVideoForwarderConfig S3 video forward supporting recording video segments

type ReqRespClientConfig

type ReqRespClientConfig struct {
	// GCPProject the GCP project to operate in
	GCPProject string `mapstructure:"gcpProject" json:"gcpProject" validate:"required"`
	// InboudRequestTopic the PubSub topic this client listen on for inbound request
	InboudRequestTopic PubSubSubcriptionConfig `mapstructure:"self" json:"self" validate:"required,dive"`
	// SupportWorkerCount number of support workers to spawn to process inbound requests
	SupportWorkerCount int `mapstructure:"supportWorkerCount" json:"supportWorkerCount" validate:"required"`
	// MaxOutboundRequestDurationInSec the max duration for outbound request in secs
	MaxOutboundRequestDurationInSec uint32 `mapstructure:"outboundRequestDurationInSec" json:"outboundRequestDurationInSec" validate:"gte=5,lte=60"`
	// RequestTimeoutEnforceIntInSec outbound request timeout enforcement check interval in secs
	RequestTimeoutEnforceIntInSec uint32 `mapstructure:"requestTimeoutEnforceIntInSec" json:"requestTimeoutEnforceIntInSec" validate:"gte=15,lte=120"`
}

ReqRespClientConfig PubSub request-response client config

func (ReqRespClientConfig) MaxOutboundRequestDuration

func (c ReqRespClientConfig) MaxOutboundRequestDuration() time.Duration

MaxOutboundRequestDuration convert MaxOutboundRequestDurationInSec to time.Duration

func (ReqRespClientConfig) RequestTimeoutEnforceInt

func (c ReqRespClientConfig) RequestTimeoutEnforceInt() time.Duration

RequestTimeoutEnforceInt convert RequestTimeoutEnforceIntInSec to time.Duration

type S3Config

type S3Config struct {
	// ServerEndpoint S3 server endpoint
	ServerEndpoint string `mapstructure:"endpoint" json:"endpoint" validate:"required"`
	// UseTLS whether to TLS when connecting
	UseTLS bool `mapstructure:"useTLS" json:"useTLS"`
	// Creds S3 credentials
	Creds *S3Credentials `mapstructure:"creds" json:"creds,omitempty" validate:"omitempty,dive"`
}

S3Config S3 object store config

type S3Credentials

type S3Credentials struct {
	// AccessKey user access key
	AccessKey string
	// SecretAccessKey user secret access key
	SecretAccessKey string
}

S3Credentials S3 credentials

type SqliteConfig

type SqliteConfig struct {
	// DBFile the sqlite DB file path
	DBFile string `mapstructure:"db" json:"db" validate:"required"`
}

SqliteConfig sqlite config

type SystemManagementConfig

type SystemManagementConfig struct {
	// APIServer management REST API server config
	APIServer APIServerConfig `mapstructure:"api" json:"api" validate:"required,dive"`
	// RRClient PubSub request-response client config
	RRClient ReqRespClientConfig `mapstructure:"requestResponse" json:"requestResponse" validate:"required,dive"`
	// SourceManagement video source management settings
	SourceManagement VideoSourceManagementConfig `mapstructure:"videoSourceManagement" json:"videoSourceManagement" validate:"required,dive"`
	// RecordingManagement recording session management settings
	RecordingManagement RecordingManagementConfig `mapstructure:"recordingManagement" json:"recordingManagement" validate:"required,dive"`
}

SystemManagementConfig define control node management sub-module config

type VODServerConfig

type VODServerConfig struct {
	// LiveVODSegmentCount number of video segments to include when building a live
	// VOD playlist.
	LiveVODSegmentCount int `mapstructure:"liveVODSegmentCount" json:"liveVODSegmentCount" validate:"gte=1"`
	// SegmentCacheTTLInSec when a segment is read from cold storage, store it in
	// local cache with this TTL in secs.
	SegmentCacheTTLInSec uint32 `mapstructure:"segmentCacheTTLInSec" json:"segmentCacheTTLInSec" validate:"gte=30,lte=7200"`
}

VODServerConfig HLS VOD server config

func (VODServerConfig) SegmentCacheTTL

func (c VODServerConfig) SegmentCacheTTL() time.Duration

SegmentCacheTTL convert SegmentCacheTTLInSec to time.Duration

type VideoForwarderConfig

type VideoForwarderConfig struct {
	// Live HTTP video forward supporting live stream through control node
	Live LiveStreamVideoForwarderConfig `mapstructure:"live" json:"live" validate:"required,dive"`
	// Recording support video recording video segment forwarding to object store
	Recording RecordingVideoForwarderConfig `mapstructure:"recording" json:"recording" validate:"required,dive"`
}

VideoForwarderConfig video segment forwarding config

type VideoSegment

type VideoSegment struct {
	ID string `json:"id" gorm:"column:id;primaryKey;unique" validate:"required"`
	hls.Segment
	// SourceID link to parent video source
	SourceID string `json:"source" gorm:"column:source;not null;primaryKey" validate:"required"`
	// Uploaded whether this segment had already been uploaded for a recording session
	Uploaded  *int      `json:"uploaded,omitempty" gorm:"column:uploaded;default:null" validate:"omitempty,oneof=-1 1"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

VideoSegment a single HLS TS segment

type VideoSegmentWithData

type VideoSegmentWithData struct {
	VideoSegment
	Content []byte
}

VideoSegmentWithData a single HLS TS segment with its data

type VideoSource

type VideoSource struct {
	// ID video source ID
	ID string `json:"id" gorm:"column:id;primaryKey" validate:"required"`
	// Name video source name
	Name string `json:"name" gorm:"column:name;not null;uniqueIndex:video_source_name_index" validate:"required"`
	// TargetSegmentLength expected length of video segments produces by this source
	TargetSegmentLength int `json:"segment_length" gorm:"column:segment_length;not null" validate:"required,gte=1"`
	// Description an optional description of the video source
	Description *string `json:"description,omitempty" gorm:"column:description;default:null"`
	// Streaming whether this source's video is being streamed through the system control node
	Streaming int `json:"streaming" gorm:"column:streaming;default:-1" validate:"oneof=-1 1"`
	// PlaylistURI video source HLS playlist file URI
	PlaylistURI *string `json:"playlist,omitempty" gorm:"column:playlist;default:null" validate:"omitempty,uri"`
	// ReqRespTargetID target ID on the request-response network
	ReqRespTargetID *string `json:"rr_target,omitempty" gorm:"column:rr_target;default:null" validate:"omitempty"`
	// SourceLocalTime local time at the video source
	SourceLocalTime time.Time `json:"local_time" gorm:"column:local_time;default:null"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
}

VideoSource a single HLS video source

type VideoSourceConfig

type VideoSourceConfig struct {
	// Name video source system entry name (as recorded by the system control node)
	Name string `mapstructure:"name" json:"name" validate:"required"`
	// StatusReportIntInSec interval in secs between video source status report to system controller
	StatusReportIntInSec uint32 `mapstructure:"statusReportIntInSec" json:"statusReportIntInSec" validate:"gte=10"`
}

VideoSourceConfig define a HLS video source being monitored

func (VideoSourceConfig) StatusReportInt

func (c VideoSourceConfig) StatusReportInt() time.Duration

StatusReportInt convert StatusReportIntInSec to time.Duration

type VideoSourceManagementConfig

type VideoSourceManagementConfig struct {
	// StatusReportMaxDelayInSec maximum delay a source status report can be before the
	// control node marks source as no longer connected
	StatusReportMaxDelayInSec uint32 `mapstructure:"statusReportMaxDelayInSec" json:"statusReportMaxDelayInSec" validate:"required,gte=20"`
}

VideoSourceManagementConfig video source management settings

func (VideoSourceManagementConfig) StatusReportMaxDelay

func (c VideoSourceManagementConfig) StatusReportMaxDelay() time.Duration

StatusReportMaxDelay convert StatusReportMaxDelayInSec to time.Duration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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