Documentation
¶
Index ¶
- Constants
- Variables
- func BaseTokenAmountToFixed(baseAmount *big.Int) (int64, error)
- func BytesToVideoProfile(txData []byte) ([]ffmpeg.VideoProfile, error)
- func DefaultProfileName(width int, height int, bitrate int) string
- func EncoderProfileNameToValue(profile string) (ffmpeg.Profile, 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 GetPass(s string) (string, error)
- func IgnoreRoutines() []goleak.Option
- func JoinURL(url, path string) string
- func MaxUint256OrFatal(t *testing.T) *big.Int
- func ParseBigInt(num string) (*big.Int, error)
- func ParseNvidiaDevices(nvidia string) ([]string, error)
- func PriceToFixed(price *big.Rat) (int64, 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 Retry(attempts int, sleep time.Duration, fn func() error) error
- func ToInt64(val *big.Int) int64
- func TxDataToVideoProfile(txData string) ([]ffmpeg.VideoProfile, error)
- func TypeByExtension(ext string) (string, error)
- func WaitAssert(t *testing.T, waitTime time.Duration, condition func() bool, msg string)
- func WaitUntil(waitTime time.Duration, condition func() 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) 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 DetectionWebhookRequest
- type NodeStatus
- type OrchestratorLocalInfo
- type OrchestratorPool
- type OrchestratorStore
- type RemoteTranscoderInfo
- type RoundsManager
- type SceneClassificationResult
- type ScorePred
- 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") ErrProfile = fmt.Errorf("failed to parse profile") 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") ErrProfName = fmt.Errorf("unknown VideoProfile profile name") )
var ErrDBTooNew = errors.New("DB Too New")
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 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 SegmentUploadTimeout = 2 * time.Second
SegmentUploadTimeout timeout used in HTTP connections 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",
}
Functions ¶
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 BytesToVideoProfile ¶ added in v0.5.0
func BytesToVideoProfile(txData []byte) ([]ffmpeg.VideoProfile, error)
func DefaultProfileName ¶ added in v0.5.2
func EncoderProfileNameToValue ¶ added in v0.5.9
func FFmpegProfiletoNetProfile ¶ added in v0.5.2
func FFmpegProfiletoNetProfile(ffmpegProfiles []ffmpeg.VideoProfile) ([]*net.VideoProfile, error)
func FixedToPrice ¶ added in v0.5.5
FixedToPrice converts an 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 GetPass ¶ added in v0.5.2
GetPass attempts to read a file for a password 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 IgnoreRoutines ¶ added in v0.5.12
IgnoreRoutines goroutines to ignore in tests
func ParseNvidiaDevices ¶ added in v0.5.18
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 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 TxDataToVideoProfile ¶ added in v0.3.3
func TxDataToVideoProfile(txData string) ([]ffmpeg.VideoProfile, error)
func TypeByExtension ¶ added in v0.5.13
func WaitAssert ¶
Types ¶
type Broadcaster ¶ added in v0.5.1
type CapabilityComparator ¶ added in v0.5.10
type CapabilityComparator interface { CompatibleWith(*net.Capabilities) bool LegacyOnly() bool }
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) 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 }
DBOrch is the type binding for a row result from the unbondingLocks table
type DetectionWebhookRequest ¶ added in v0.5.23
type DetectionWebhookRequest struct { ManifestID string `json:"manifestID"` SeqNo uint64 `json:"seqNo"` SceneClassification []SceneClassificationResult `json:"sceneClassification"` }
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 }
type OrchestratorLocalInfo ¶ added in v0.5.23
func (*OrchestratorLocalInfo) MarshalJSON ¶ added in v0.5.23
func (u *OrchestratorLocalInfo) MarshalJSON() ([]byte, error)
type OrchestratorPool ¶ added in v0.5.1
type OrchestratorPool interface { // GetInfo gets info for specific orchestrator GetInfo(uri string) OrchestratorLocalInfo GetInfos() []OrchestratorLocalInfo GetOrchestrators(context.Context, int, Suspender, CapabilityComparator, ScorePred) ([]*net.OrchestratorInfo, 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 SceneClassificationResult ¶ added in v0.5.23
type ScorePred ¶ added in v0.5.23
func ScoreAtLeast ¶ added in v0.5.23
func ScoreEqualTo ¶ added in v0.5.23
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