service

package
v0.0.0-...-a73d9ad Latest Latest
Warning

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

Go to latest
Published: May 10, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusCreated = iota
	StatusRunned
	StatusStopping
	StatusStopped
)

StatusCreated, StatusRunned, StatusStopping, StatusStopped are constants that defines all status of Service

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseService

type BaseService struct {
	Service
	// contains filtered or unexported fields
}

BaseService is base service used by all services, attached to Streamer

func (*BaseService) IsNeedStop

func (s *BaseService) IsNeedStop() bool

IsNeedStop returns if BaseService is need to stop

func (*BaseService) SetStatus

func (s *BaseService) SetStatus(v uint32)

SetStatus sets status of Service

func (*BaseService) Status

func (s *BaseService) Status() uint32

Status returns current status of service

func (*BaseService) Stop

func (s *BaseService) Stop()

Stop stops BaseService

type HTTPService

type HTTPService struct {
	BaseService
	// contains filtered or unexported fields
}

HTTPService implements a simple api for streamer

func (*HTTPService) Init

func (h *HTTPService) Init(s *Streamer) error

Init initializes echo server, http routing and logger

func (*HTTPService) Name

func (h *HTTPService) Name() string

Name returns name of service

func (*HTTPService) Run

func (h *HTTPService) Run() error

Run runs service

type Service

type Service interface {
	Init(*Streamer) error
	Run() error
	Name() string
	Stop()
}

Service interface is base service, with simple API

type Streamer

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

Streamer is main struct of daemon it stores all services that used by

func NewStreamer

func NewStreamer(config *conf.StreamerConfig) *Streamer

NewStreamer creates and returns new StreamerInstance

func (*Streamer) AddService

func (s *Streamer) AddService(srv Service)

AddService adds service into Streamer.services map

func (*Streamer) Config

func (s *Streamer) Config() conf.StreamerConfig

Config returns current instance of StreamerConfig

func (*Streamer) Start

func (s *Streamer) Start() error

Start starts all services in separate goroutine

func (*Streamer) Stop

func (s *Streamer) Stop()

Stop stops all services running

func (*Streamer) WaitStop

func (s *Streamer) WaitStop()

WaitStop blocks main thread and waits when all goroutines will be stopped

func (*Streamer) YoutubeStreamService

func (s *Streamer) YoutubeStreamService() *YoutubeStreamService

YoutubeStreamService returns *YoutubeStreamService

type YoutubeStreamService

type YoutubeStreamService struct {
	BaseService
	// contains filtered or unexported fields
}

YoutubeStreamService re-streams youtube video on the fly to rtmp server

func (*YoutubeStreamService) AddAutoStream

func (ys *YoutubeStreamService) AddAutoStream(as data.Stream)

func (*YoutubeStreamService) AddStream

func (ys *YoutubeStreamService) AddStream(stream data.StreamItem, download bool)

AddStream adds stream and runs it gracefully

func (*YoutubeStreamService) Init

func (ys *YoutubeStreamService) Init(s *Streamer) error

Init initializes logger and service

func (*YoutubeStreamService) Name

func (ys *YoutubeStreamService) Name() string

Name returns name of service

func (*YoutubeStreamService) Run

func (ys *YoutubeStreamService) Run() error

Run runs YoutubeStreamService

func (*YoutubeStreamService) UpdateAutoStream

func (ys *YoutubeStreamService) UpdateAutoStream(as data.Stream)

func (*YoutubeStreamService) UpdateStream

func (ys *YoutubeStreamService) UpdateStream(stream data.Stream, download bool)

UpdateStream updates stream storage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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