Documentation
¶
Index ¶
- Constants
- Variables
- func BytesToVideoProfile(txData []byte) ([]ffmpeg.VideoProfile, error)
- func GenErrRegex(errStrings []string) *regexp.Regexp
- func GetConnectionAddr(ctx context.Context) string
- func MaxUint256OrFatal(t *testing.T) *big.Int
- func ParseBigInt(num string) (*big.Int, error)
- func PriceToFixed(price *big.Rat) (int64, error)
- func ProfilesNames(profiles []ffmpeg.VideoProfile) string
- func ProfilesToHex(profiles []ffmpeg.VideoProfile) string
- func ProfilesToTranscodeOpts(profiles []ffmpeg.VideoProfile) []byte
- func RandName() string
- func Retry(attempts int, sleep time.Duration, fn func() error) error
- func TxDataToVideoProfile(txData string) ([]ffmpeg.VideoProfile, 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 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) LoadWinningTickets(sessionIDs []string) (tickets []*pm.Ticket, sigs [][]byte, recipientRands []*big.Int, err error)
- func (db *DB) OrchCount(filter *DBOrchFilter) (int, error)
- func (db *DB) SelectOrchs(filter *DBOrchFilter) ([]*DBOrch, error)
- func (db *DB) SetChainID(id *big.Int) error
- func (db *DB) StoreWinningTicket(sessionID string, ticket *pm.Ticket, sig []byte, recipientRand *big.Int) 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
- type DBOrch
- type DBOrchFilter
- type DBUnbondingLock
- type OrchestratorPool
- type OrchestratorStore
- 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 VideoProfileByteMap
Constants ¶
const DEBUG = 5
const HTTPTimeout = 8 * time.Second
HTTPTimeout timeout used in HTTP connections between nodes
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") )
var ErrDBTooNew = errors.New("DB Too New")
var LivepeerDBVersion = 1
var RandomIDGenerator = func(length uint) string { x := make([]byte, length, length) for i := 0; i < len(x); i++ { x[i] = byte(rand.Uint32()) } return hex.EncodeToString(x) }
RandomIDGenerator generates random hexadecimal string of specified length defined as variable for unit tests
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 BytesToVideoProfile ¶ added in v0.5.0
func BytesToVideoProfile(txData []byte) ([]ffmpeg.VideoProfile, error)
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 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 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 TxDataToVideoProfile ¶ added in v0.3.3
func TxDataToVideoProfile(txData string) ([]ffmpeg.VideoProfile, error)
func WaitAssert ¶
Types ¶
type Broadcaster ¶ added in v0.5.1
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) LoadWinningTickets ¶ added in v0.5.0
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) 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 }
DBOrch is the type binding for a row result from the orchestrators table
type DBOrchFilter ¶ added in v0.5.0
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 OrchestratorPool ¶ added in v0.5.1
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 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