net

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcaster

type Broadcaster interface {
	Broadcast(seqNo uint64, data []byte) error
	IsWorking() bool
	Finish() error
	String() string
}

Broadcaster takes a streamID and a reader, and broadcasts the data to whatever underlining network. Note the data param doesn't have to be the raw data. The implementation can choose to encode any struct. Example:

s := GetStream("StrmID")
b := ppspp.NewBroadcaster("StrmID", s.Metadata())
for seqNo, data := range s.Segments() {
	b.Broadcast(seqNo, data)
}
b.Finish()

type NodeStatus

type NodeStatus struct {
	NodeID    string
	Manifests map[string]*m3u8.MasterPlaylist
}

func (*NodeStatus) FromString

func (n *NodeStatus) FromString(str string) error

func (NodeStatus) String

func (n NodeStatus) String() string

type Subscriber

type Subscriber interface {
	Subscribe(ctx context.Context, gotData func(seqNo uint64, data []byte, eof bool)) error
	IsWorking() bool
	Unsubscribe() error
	String() string
}

Subscriber subscribes to a stream defined by strmID. It returns a reader that contains the stream. Example 1:

sub, metadata := ppspp.NewSubscriber("StrmID")
stream := NewStream("StrmID", metadata)
ctx, cancel := context.WithCancel(context.Background()
err := sub.Subscribe(ctx, func(seqNo uint64, data []byte){
	stream.WriteSeg(seqNo, data)
})
time.Sleep(time.Second * 5)
cancel()

Example 2:

sub.Unsubscribe() //This is the same with calling cancel()

type TranscodeConfig

type TranscodeConfig struct {
	StrmID              string
	Profiles            []lpmscore.VideoProfile
	PerformOnchainClaim bool
	JobID               *big.Int
}

type Transcoder

type Transcoder interface {
	Transcode(strmID string, config TranscodeConfig, gotPlaylist func(masterPlaylist []byte)) error
}

type VideoNetwork

type VideoNetwork interface {
	GetNodeID() string
	GetMasterPlaylist(nodeID string, manifestID string) (chan *m3u8.MasterPlaylist, error)
	UpdateMasterPlaylist(manifestID string, mpl *m3u8.MasterPlaylist) error
	GetBroadcaster(strmID string) (Broadcaster, error)
	GetSubscriber(strmID string) (Subscriber, error)
	Connect(nodeID string, nodeAddr []string) error
	SetupProtocol() error
	SendTranscodeResponse(nodeID string, manifestID string, transcodeResult map[string]string) error
	ReceivedTranscodeResponse(manifestID string, gotResult func(transcodeResult map[string]string))
	GetNodeStatus(nodeID string) (chan *NodeStatus, error)
	String() string
}

VideoNetwork describes the interface for a Livepeer node network-layer library.

Jump to

Keyboard shortcuts

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