common

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DEBUG = 5
View Source
const SHORT = 4
View Source
const VERBOSE = 6

Variables

View Source
var ErrDBTooNew = errors.New("DB Too New")
View Source
var (
	ErrParseBigInt = fmt.Errorf("failed to parse big integer")
)
View Source
var LivepeerDBVersion = 1
View Source
var VideoProfileIDSize = 8
View Source
var VideoProfileNameLookup = map[string]string{
	"a7ac137a": "P720p60fps16x9",
	"49d54ea9": "P720p30fps16x9",
	"79332fe7": "P720p30fps4x3",
	"5ecf4b52": "P576p30fps16x9",
	"93c717e7": "P360p30fps16x9",
	"b60382a0": "P360p30fps4x3",
	"c0a6517a": "P240p30fps16x9",
	"d435c53a": "P240p30fps4x3",
	"fca40bf9": "P144p30fps16x9",
}

Functions

func DBJobToEthJob added in v0.3.3

func DBJobToEthJob(j *DBJob) *lpTypes.Job

func ParseBigInt added in v0.3.3

func ParseBigInt(num string) (*big.Int, error)

func ProfilesToTranscodeOpts added in v0.3.3

func ProfilesToTranscodeOpts(profiles []ffmpeg.VideoProfile) []byte

func Retry

func Retry(attempts int, sleep time.Duration, fn func() error) error

func TxDataToVideoProfile added in v0.3.3

func TxDataToVideoProfile(txData string) ([]ffmpeg.VideoProfile, error)

func WaitAssert

func WaitAssert(t *testing.T, waitTime time.Duration, condition func() bool, msg string)

func WaitUntil

func WaitUntil(waitTime time.Duration, condition func() bool)

Types

type DB added in v0.3.3

type DB struct {
	// contains filtered or unexported fields
}

func InitDB added in v0.3.3

func InitDB(dbPath string) (*DB, error)

func TempDB added in v0.3.3

func TempDB(t *testing.T) (*DB, *sql.DB, error)

func (*DB) ActiveBroadcasts added in v0.3.3

func (db *DB) ActiveBroadcasts(since *big.Int) ([]*DBJob, error)

func (*DB) ActiveJobs added in v0.3.3

func (db *DB) ActiveJobs(since *big.Int) ([]*DBJob, error)

func (*DB) Close added in v0.3.3

func (db *DB) Close()

func (*DB) InsertBroadcast added in v0.3.3

func (db *DB) InsertBroadcast(job *lpTypes.Job) error

func (*DB) InsertClaim added in v0.3.3

func (db *DB) InsertClaim(jobID *big.Int, segRange [2]int64,
	root [32]byte) (*int64, error)

func (*DB) InsertJob added in v0.3.3

func (db *DB) InsertJob(job *DBJob) error

func (*DB) InsertReceipt added in v0.3.3

func (db *DB) InsertReceipt(jobID *big.Int, seqNo int64,
	bcastFile string, bcastHash []byte, bcastSig []byte, tcodeHash []byte,
	tcodeStartedAt time.Time, tcodeEndedAt time.Time) error

func (*DB) InsertUnbondingLock added in v0.3.3

func (db *DB) InsertUnbondingLock(id *big.Int, delegator ethcommon.Address, amount, withdrawRound *big.Int) error

func (*DB) LastSeenBlock added in v0.3.3

func (db *DB) LastSeenBlock() (*big.Int, error)

func (*DB) ReceiptBCastFilesByClaim added in v0.3.3

func (db *DB) ReceiptBCastFilesByClaim(claimID int64, jobID *big.Int) ([]string, error)

func (*DB) ReceiptExists added in v0.3.3

func (db *DB) ReceiptExists(jobID *big.Int, seqNo uint64) (bool, error)

func (*DB) SetClaimStatus added in v0.3.3

func (db *DB) SetClaimStatus(jobID *big.Int, id int64, status string) error

func (*DB) SetLastSeenBlock added in v0.3.3

func (db *DB) SetLastSeenBlock(block *big.Int) error

func (*DB) SetSegmentCount added in v0.3.3

func (db *DB) SetSegmentCount(jobID *big.Int, count int64) error

func (*DB) SetStopReason added in v0.3.3

func (db *DB) SetStopReason(id *big.Int, reason string) error

func (*DB) UnbondingLockIDs added in v0.3.3

func (db *DB) UnbondingLockIDs() ([]*big.Int, error)

func (*DB) UnbondingLocks added in v0.3.3

func (db *DB) UnbondingLocks(currentRound *big.Int) ([]*DBUnbondingLock, error)

func (*DB) UnclaimedReceipts added in v0.3.3

func (db *DB) UnclaimedReceipts() (map[int64][]*DBReceipt, error)

func (*DB) UseUnbondingLock added in v0.3.3

func (db *DB) UseUnbondingLock(id *big.Int, delegator ethcommon.Address, usedBlock *big.Int) error

type DBJob added in v0.3.3

type DBJob struct {
	ID int64

	Transcoder ethcommon.Address

	Segments int64
	// contains filtered or unexported fields
}

func NewDBJob added in v0.3.3

func NewDBJob(id *big.Int, streamID string,
	segmentPrice *big.Int, profiles []ffmpeg.VideoProfile,
	broadcaster ethcommon.Address, transcoder ethcommon.Address,
	startBlock *big.Int, endBlock *big.Int) *DBJob

type DBReceipt added in v0.3.3

type DBReceipt struct {
	JobID     int64
	SeqNo     int64
	BcastFile string
	BcastHash []byte
	BcastSig  []byte
	TcodeHash []byte
}

type DBUnbondingLock added in v0.3.3

type DBUnbondingLock struct {
	ID            int64
	Delegator     ethcommon.Address
	Amount        *big.Int
	WithdrawRound int64
}

Jump to

Keyboard shortcuts

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