Documentation
¶
Index ¶
- Constants
- Variables
- func AppendHostname(urlPath string, host string) (*url.URL, error)
- func BaseTokenAmountToFixed(baseAmount *big.Int) (int64, error)
- func CalculateAudioDuration(audio types.File) (int64, error)
- func FFmpegProfiletoNetProfile(ffmpegProfiles []ffmpeg.VideoProfile) ([]*net.VideoProfile, error)
- func FixedToPrice(price int64) *big.Rat
- func GenErrRegex(errStrings []string) *regexp.Regexp
- func GetConnectionAddr(ctx context.Context) string
- func IgnoreRoutines() []goleak.Option
- func JoinURL(url, path string) string
- func MaxUint256OrFatal(t *testing.T) *big.Int
- func MimeTypeToExtension(mimeType string) (string, error)
- func ParseAccelDevices(devices string, acceleration ffmpeg.Acceleration) ([]string, error)
- func ParseBigInt(num string) (*big.Int, error)
- func ParseEthAddr(strJsonKey string) (string, error)
- func PriceToFixed(price *big.Rat) (int64, error)
- func PriceToInt64(price *big.Rat) (*big.Rat, error)
- func ProfileExtensionFormat(ext string) ffmpeg.Format
- func ProfileFormatExtension(f ffmpeg.Format) (string, error)
- func ProfileFormatMimeType(f ffmpeg.Format) (string, error)
- func ProfilesNames(profiles []ffmpeg.VideoProfile) string
- func ProfilesToHex(profiles []ffmpeg.VideoProfile) string
- func ProfilesToTranscodeOpts(profiles []ffmpeg.VideoProfile) []byte
- func RandName() string
- func RatPriceInfo(priceInfo *net.PriceInfo) (*big.Rat, error)
- func ReadAtMost(r io.Reader, n int) ([]byte, error)
- func ReadFromFile(s string) (string, error)
- func ToInt64(val *big.Int) int64
- func TypeByExtension(ext string) (string, error)
- func ValidateServiceURI(serviceURI *url.URL) bool
- type Broadcaster
- type CapabilityComparator
- type DB
- func (db *DB) ChainID() (*big.Int, error)
- func (db *DB) Close()
- func (db *DB) DeleteMiniHeader(hash ethcommon.Hash) error
- func (db *DB) DeleteUnbondingLock(id *big.Int, delegator ethcommon.Address) error
- func (db *DB) FindAllMiniHeadersSortedByNumber() ([]*blockwatch.MiniHeader, error)
- func (db *DB) FindLatestMiniHeader() (*blockwatch.MiniHeader, error)
- func (db *DB) InsertMiniHeader(header *blockwatch.MiniHeader) error
- func (db *DB) InsertUnbondingLock(id *big.Int, delegator ethcommon.Address, amount, withdrawRound *big.Int) error
- func (db *DB) IsOrchActive(addr ethcommon.Address, round *big.Int) (bool, error)
- func (db *DB) LastSeenBlock() (*big.Int, error)
- func (db *DB) MarkWinningTicketRedeemed(ticket *pm.SignedTicket, txHash ethcommon.Hash) error
- func (db *DB) OrchCount(filter *DBOrchFilter) (int, error)
- func (db *DB) RemoveWinningTicket(ticket *pm.SignedTicket) error
- func (db *DB) SelectEarliestWinningTicket(sender ethcommon.Address, minCreationRound int64) (*pm.SignedTicket, error)
- func (db *DB) SelectOrchs(filter *DBOrchFilter) ([]*DBOrch, error)
- func (db *DB) SetChainID(id *big.Int) error
- func (db *DB) StoreWinningTicket(ticket *pm.SignedTicket) error
- func (db *DB) UnbondingLockIDs() ([]*big.Int, error)
- func (db *DB) UnbondingLocks(currentRound *big.Int) ([]*DBUnbondingLock, error)
- func (db *DB) UpdateOrch(orch *DBOrch) error
- func (db *DB) UseUnbondingLock(id *big.Int, delegator ethcommon.Address, usedBlock *big.Int) error
- func (db *DB) WinningTicketCount(sender ethcommon.Address, minCreationRound int64) (int, error)
- type DBOrch
- type DBOrchFilter
- type DBUnbondingLock
- type NodeStatus
- type OrchestratorDescriptor
- type OrchestratorDescriptors
- type OrchestratorLocalInfo
- type OrchestratorPool
- type OrchestratorStore
- type PerfScore
- type RemoteTranscoderInfo
- type RoundsManager
- type ScorePred
- type SelectionAlgorithm
- type StreamInfo
- type StubServerStream
- func (s *StubServerStream) Context() context.Context
- func (s *StubServerStream) RecvMsg(m interface{}) error
- func (s *StubServerStream) Send(n *net.NotifySegment) error
- func (s *StubServerStream) SendHeader(md metadata.MD) error
- func (s *StubServerStream) SendMsg(m interface{}) error
- func (s *StubServerStream) SetHeader(md metadata.MD) error
- func (s *StubServerStream) SetTrailer(md metadata.MD)
- type Suspender
- type VideoProfileByteMap
Constants ¶
const ( Score_Untrusted = 0.0 Score_Trusted = 1.0 )
const DEBUG = 5
const SHORT = 4
const VERBOSE = 6
const VideoProfileIDBytes = 4
const VideoProfileIDSize = 8
Variables ¶
var ( ErrParseBigInt = fmt.Errorf("failed to parse big integer") ErrChromaFormat = fmt.Errorf("unknown VideoProfile ChromaFormat") ErrFormatProto = fmt.Errorf("unknown VideoProfile format for protobufs") ErrFormatMime = fmt.Errorf("unknown VideoProfile format for mime type") ErrFormatExt = fmt.Errorf("unknown VideoProfile format for extension") ErrProfProto = fmt.Errorf("unknown VideoProfile profile for protobufs") ErrProfEncoder = fmt.Errorf("unknown VideoProfile encoder for protobufs") ErrProfName = fmt.Errorf("unknown VideoProfile profile name") ErrAudioDurationCalculation = fmt.Errorf("audio duration calculation failed") ErrNoExtensionsForType = fmt.Errorf("no extensions exist for mime type") )
var ErrDBTooNew = errors.New("DB Too New")
var HTTPDialTimeout = 2 * time.Second
HTTPDialTimeout timeout used to establish an HTTP connection between nodes
var HTTPTimeout = 8 * time.Second
HTTPTimeout timeout used in HTTP connections between nodes
var LivepeerDBVersion = 1
var MaxDuration = (5 * time.Minute)
Max Segment Duration
var MaxSegSize = int(MaxDuration.Seconds()) * (maxInputBitrate / 8)
Max Segment Size in bytes (cap reading HTTP response body at this size)
var MinSegmentUploadTimeout = 2 * time.Second
MinSegmentUploadTimeout defines the minimum timeout enforced for uploading a segment to orchestrators
var RandomBytesGenerator = func(length uint) []byte { x := make([]byte, length, length) for i := 0; i < len(x); i++ { x[i] = byte(rand.Uint32()) } return x }
var RandomIDGenerator = func(length uint) string { return hex.EncodeToString(RandomBytesGenerator(length)) }
RandomIDGenerator generates random hexadecimal string of specified length defined as variable for unit tests
var SegHttpPushTimeoutMultiplier = 4.0
SegHttpPushTimeoutMultiplier used in the HTTP connection for pushing the segment
var SegUploadTimeoutMultiplier = 0.5
SegUploadTimeoutMultiplier used in HTTP connection for uploading the segment
var VideoProfileByteLookup = makeVideoProfileByteMap()
var VideoProfileNameLookup = map[string]string{
"a7ac137a": "P720p60fps16x9",
"49d54ea9": "P720p30fps16x9",
"e4a64019": "P720p25fps16x9",
"79332fe7": "P720p30fps4x3",
"5ecf4b52": "P576p30fps16x9",
"8b1843d6": "P576p25fps16x9",
"93c717e7": "P360p30fps16x9",
"7cd40fc7": "P360p25fps16x9",
"b60382a0": "P360p30fps4x3",
"c0a6517a": "P240p30fps16x9",
"1301a7d0": "P240p25fps16x9",
"d435c53a": "P240p30fps4x3",
"fca40bf9": "P144p30fps16x9",
"03f01d1f": "P144p25fps16x9",
}
var WebhookDiscoveryRefreshInterval = 1 * time.Minute
WebhookDiscoveryRefreshInterval defines for long the Webhook Discovery values should be cached
Functions ¶
func AppendHostname ¶ added in v0.8.1
func BaseTokenAmountToFixed ¶ added in v0.5.2
BaseTokenAmountToFixed converts the base amount of a token (i.e. ETH/LPT) represented as a big.Int into a fixed point number represented as a int64 using a scalingFactor of 100000 resulting in max decimal places of 5
func CalculateAudioDuration ¶ added in v0.8.0
CalculateAudioDuration calculates audio file duration using the lpms/ffmpeg package.
func FFmpegProfiletoNetProfile ¶ added in v0.5.2
func FFmpegProfiletoNetProfile(ffmpegProfiles []ffmpeg.VideoProfile) ([]*net.VideoProfile, error)
func FixedToPrice ¶ added in v0.5.5
FixedToPrice converts a fixed point number with 3 decimal places represented as in int64 into a big.Rat
func GenErrRegex ¶ added in v0.5.0
GenErrRegex generates a regexp `(err1)|(err2)|(err3)` given a list of error strings [err1, err2, err3]
func GetConnectionAddr ¶ added in v0.5.0
func IgnoreRoutines ¶ added in v0.5.12
IgnoreRoutines goroutines to ignore in tests
func MimeTypeToExtension ¶ added in v0.8.0
MimeTypeToExtension returns the file extension for a given MIME type.
func ParseAccelDevices ¶ added in v0.5.30
func ParseAccelDevices(devices string, acceleration ffmpeg.Acceleration) ([]string, error)
func ParseEthAddr ¶ added in v0.5.38
func PriceToFixed ¶ added in v0.5.0
PriceToFixed converts a big.Rat into a fixed point number represented as int64 using a scaleFactor of 1000 resulting in max decimal places of 3
func PriceToInt64 ¶ added in v0.8.0
PriceToInt64 converts a *big.Rat to an *int64 if possible, otherwise returns an error.
func ProfileExtensionFormat ¶ added in v0.5.6
func ProfileFormatExtension ¶ added in v0.5.6
func ProfileFormatMimeType ¶ added in v0.5.6
func ProfilesNames ¶ added in v0.5.0
func ProfilesNames(profiles []ffmpeg.VideoProfile) string
func ProfilesToHex ¶ added in v0.5.0
func ProfilesToHex(profiles []ffmpeg.VideoProfile) string
func ProfilesToTranscodeOpts ¶ added in v0.3.3
func ProfilesToTranscodeOpts(profiles []ffmpeg.VideoProfile) []byte
func ReadAtMost ¶ added in v0.5.17
Read at most n bytes from an io.Reader
func ReadFromFile ¶ added in v0.5.35
ReadFromFile attempts to read a file at the supplied location. If it fails, then the original supplied string will be returned to the caller. A valid string will always be returned, regardless of whether an error occurred.
func TypeByExtension ¶ added in v0.5.13
func ValidateServiceURI ¶ added in v0.7.9
ValidateServiceURI checks if the serviceURI is valid.
Types ¶
type Broadcaster ¶ added in v0.5.1
type CapabilityComparator ¶ added in v0.5.10
type CapabilityComparator interface { CompatibleWith(*net.Capabilities) bool LegacyOnly() bool ToNetCapabilities() *net.Capabilities }
type DB ¶ added in v0.3.3
type DB struct {
// contains filtered or unexported fields
}
DB is an initialized DB driver with prepared statements
func (*DB) DeleteMiniHeader ¶ added in v0.5.0
DeleteMiniHeader deletes a MiniHeader from the DB and takes in the blockhash of the block to be deleted as an argument
func (*DB) DeleteUnbondingLock ¶ added in v0.5.0
DeleteUnbondingLock deletes an unbonding lock from the DB with the given ID and delegator address. This method will return nil for non-existent unbonding locks
func (*DB) FindAllMiniHeadersSortedByNumber ¶ added in v0.5.0
func (db *DB) FindAllMiniHeadersSortedByNumber() ([]*blockwatch.MiniHeader, error)
FindAllMiniHeadersSortedByNumber returns all MiniHeaders in the DB sorting in descending order by block number
func (*DB) FindLatestMiniHeader ¶ added in v0.5.0
func (db *DB) FindLatestMiniHeader() (*blockwatch.MiniHeader, error)
FindLatestMiniHeader returns the MiniHeader with the highest blocknumber in the DB
func (*DB) InsertMiniHeader ¶ added in v0.5.0
func (db *DB) InsertMiniHeader(header *blockwatch.MiniHeader) error
InsertMiniHeader inserts a MiniHeader into the database
func (*DB) InsertUnbondingLock ¶ added in v0.3.3
func (*DB) IsOrchActive ¶ added in v0.5.28
func (*DB) LastSeenBlock ¶ added in v0.3.3
LastSeenBlock returns the last block number stored by the DB
func (*DB) MarkWinningTicketRedeemed ¶ added in v0.5.9
MarkWinningTicketRedeemed stores the on-chain transaction hash and timestamp of redemption This marks the ticket as being 'redeemed'
func (*DB) RemoveWinningTicket ¶ added in v0.5.9
func (db *DB) RemoveWinningTicket(ticket *pm.SignedTicket) error
RemoveWinningTicket removes a ticket
func (*DB) SelectEarliestWinningTicket ¶ added in v0.5.9
func (db *DB) SelectEarliestWinningTicket(sender ethcommon.Address, minCreationRound int64) (*pm.SignedTicket, error)
SelectEarliestWinningTicket selects the earliest stored winning ticket for a 'sender' that is not expired and not yet redeemed
func (*DB) SelectOrchs ¶ added in v0.5.0
func (db *DB) SelectOrchs(filter *DBOrchFilter) ([]*DBOrch, error)
func (*DB) StoreWinningTicket ¶ added in v0.5.0
func (db *DB) StoreWinningTicket(ticket *pm.SignedTicket) error
StoreWinningTicket stores a signed ticket
func (*DB) UnbondingLocks ¶ added in v0.3.3
func (db *DB) UnbondingLocks(currentRound *big.Int) ([]*DBUnbondingLock, error)
func (*DB) UpdateOrch ¶ added in v0.5.0
func (*DB) UseUnbondingLock ¶ added in v0.3.3
UseUnbondingLock sets an unbonding lock in the DB as used by setting the lock's used block. If usedBlock is nil this method will set the lock's used block to NULL
type DBOrch ¶ added in v0.5.0
type DBOrch struct { ServiceURI string EthereumAddr string PricePerPixel int64 ActivationRound int64 DeactivationRound int64 Stake int64 // Stored as a fixed point number }
DBOrch is the type binding for a row result from the orchestrators table
type DBOrchFilter ¶ added in v0.5.0
type DBOrchFilter struct { MaxPrice *big.Rat CurrentRound *big.Int Addresses []ethcommon.Address UpdatedLastDay bool }
DBOrchFilter is an object used to attach a filter to a selectOrch query
type DBUnbondingLock ¶ added in v0.3.3
type DBUnbondingLock struct { ID int64 Delegator ethcommon.Address Amount *big.Int WithdrawRound int64 }
DBUnbondingLock is the type binding for a row result from the unbondingLocks table
type NodeStatus ¶ added in v0.5.23
type NodeStatus struct { Manifests map[string]*m3u8.MasterPlaylist // maps external manifest (provided in HTTP push URL to the internal one // (returned from webhook)) InternalManifests map[string]string StreamInfo map[string]StreamInfo OrchestratorPool []string OrchestratorPoolInfos []OrchestratorLocalInfo Version string GolangRuntimeVersion string GOArch string GOOS string RegisteredTranscodersNumber int RegisteredTranscoders []RemoteTranscoderInfo LocalTranscoding bool // Indicates orchestrator that is also transcoder BroadcasterPrices map[string]*big.Rat }
type OrchestratorDescriptor ¶ added in v0.5.33
type OrchestratorDescriptor struct { LocalInfo *OrchestratorLocalInfo RemoteInfo *net.OrchestratorInfo }
combines B's local metadata about O with info received from this O
type OrchestratorDescriptors ¶ added in v0.5.33
type OrchestratorDescriptors []OrchestratorDescriptor
func FromRemoteInfos ¶ added in v0.5.33
func FromRemoteInfos(infos []*net.OrchestratorInfo) OrchestratorDescriptors
func (OrchestratorDescriptors) GetRemoteInfos ¶ added in v0.5.33
func (ds OrchestratorDescriptors) GetRemoteInfos() []*net.OrchestratorInfo
type OrchestratorLocalInfo ¶ added in v0.5.23
func (*OrchestratorLocalInfo) MarshalJSON ¶ added in v0.5.23
func (u *OrchestratorLocalInfo) MarshalJSON() ([]byte, error)
MarshalJSON ensures that URL is marshaled as a string.
func (*OrchestratorLocalInfo) UnmarshalJSON ¶ added in v0.8.3
func (o *OrchestratorLocalInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON ensures that URL string is unmarshaled as a URL.
type OrchestratorPool ¶ added in v0.5.1
type OrchestratorPool interface { GetInfos() []OrchestratorLocalInfo GetOrchestrators(context.Context, int, Suspender, CapabilityComparator, ScorePred) (OrchestratorDescriptors, error) Size() int SizeWith(ScorePred) int }
type OrchestratorStore ¶ added in v0.5.1
type OrchestratorStore interface { OrchCount(filter *DBOrchFilter) (int, error) SelectOrchs(filter *DBOrchFilter) ([]*DBOrch, error) UpdateOrch(orch *DBOrch) error }
type RemoteTranscoderInfo ¶ added in v0.5.23
type RoundsManager ¶ added in v0.5.4
type ScorePred ¶ added in v0.5.23
func ScoreAtLeast ¶ added in v0.5.23
func ScoreEqualTo ¶ added in v0.5.23
type SelectionAlgorithm ¶ added in v0.7.0
type StreamInfo ¶ added in v0.5.23
type StubServerStream ¶ added in v0.5.0
type StubServerStream struct { }
func (*StubServerStream) Context ¶ added in v0.5.0
func (s *StubServerStream) Context() context.Context
func (*StubServerStream) RecvMsg ¶ added in v0.5.0
func (s *StubServerStream) RecvMsg(m interface{}) error
func (*StubServerStream) Send ¶ added in v0.5.0
func (s *StubServerStream) Send(n *net.NotifySegment) error
func (*StubServerStream) SendHeader ¶ added in v0.5.0
func (s *StubServerStream) SendHeader(md metadata.MD) error
func (*StubServerStream) SendMsg ¶ added in v0.5.0
func (s *StubServerStream) SendMsg(m interface{}) error
func (*StubServerStream) SetHeader ¶ added in v0.5.0
func (s *StubServerStream) SetHeader(md metadata.MD) error
func (*StubServerStream) SetTrailer ¶ added in v0.5.0
func (s *StubServerStream) SetTrailer(md metadata.MD)
type VideoProfileByteMap ¶ added in v0.5.0
type VideoProfileByteMap map[[VideoProfileIDBytes]byte]string