manager

package
v0.1.0-beta-3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HostLoadCDN  = 10
	HostLoadPeer = 4
)
View Source
const (
	PeerGoneTimeout      = int64(time.Second * 10)
	PeerForceGoneTimeout = int64(time.Minute * 2)
)
View Source
const TinyFileSize = 128

Variables

This section is empty.

Functions

This section is empty.

Types

type CDNClient

type CDNClient struct {
	client.CdnClient
	// contains filtered or unexported fields
}

type CDNManager

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

func (*CDNManager) AddToCallback

func (cm *CDNManager) AddToCallback(peerTask *types.PeerTask)

func (*CDNManager) OnNotify

func (cm *CDNManager) OnNotify(c *manager.Scheduler)

func (*CDNManager) TriggerTask

func (cm *CDNManager) TriggerTask(task *types.Task, callback func(peerTask *types.PeerTask, e *dferrors.DfError)) (err error)

func (*CDNManager) Work

func (cm *CDNManager) Work(task *types.Task, stream *client.PieceSeedStream)

type HostManager

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

func (*HostManager) Add

func (m *HostManager) Add(host *types.Host) *types.Host

func (*HostManager) CalculateLoad

func (m *HostManager) CalculateLoad(host *types.Host)

func (*HostManager) Delete

func (m *HostManager) Delete(uuid string)

func (*HostManager) Get

func (m *HostManager) Get(uuid string) (*types.Host, bool)

type Manager

type Manager struct {
	CDNManager  *CDNManager
	TaskManager *TaskManager
	HostManager *HostManager
}

func New

func New(cfg *config.Config, dynconfig config.DynconfigInterface) (*Manager, error)

type PeerTask

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

func (*PeerTask) Add

func (m *PeerTask) Add(pid string, task *types.Task, host *types.Host) *types.PeerTask

func (*PeerTask) AddFake

func (m *PeerTask) AddFake(pid string, task *types.Task) *types.PeerTask

func (*PeerTask) AddTask

func (m *PeerTask) AddTask(task *types.Task)

func (*PeerTask) CDNCallback

func (m *PeerTask) CDNCallback(pt *types.PeerTask, err *dferrors.DfError)

func (*PeerTask) ClearPeerTask

func (m *PeerTask) ClearPeerTask()

func (*PeerTask) Delete

func (m *PeerTask) Delete(pid string)

func (*PeerTask) DeleteTask

func (m *PeerTask) DeleteTask(task *types.Task)

func (*PeerTask) Get

func (m *PeerTask) Get(pid string) (h *types.PeerTask, ok bool)

func (*PeerTask) GetGCDelayTime

func (m *PeerTask) GetGCDelayTime() time.Duration

func (*PeerTask) RefreshDownloadMonitor

func (m *PeerTask) RefreshDownloadMonitor(pt *types.PeerTask)

func (*PeerTask) SetDownloadingMonitorCallBack

func (m *PeerTask) SetDownloadingMonitorCallBack(callback func(*types.PeerTask))

func (*PeerTask) SetGCDelayTime

func (m *PeerTask) SetGCDelayTime(delay time.Duration)

func (*PeerTask) Update

func (m *PeerTask) Update(pt *types.PeerTask)

func (*PeerTask) Walker

func (m *PeerTask) Walker(task *types.Task, limit int, walker func(pt *types.PeerTask) bool)

func (*PeerTask) WalkerReverse

func (m *PeerTask) WalkerReverse(task *types.Task, limit int, walker func(pt *types.PeerTask) bool)

type TaskManager

type TaskManager struct {
	PeerTask *PeerTask
	// contains filtered or unexported fields
}

func (*TaskManager) Add

func (m *TaskManager) Add(k string, task *types.Task) error

func (*TaskManager) Delete

func (m *TaskManager) Delete(k string)

func (*TaskManager) Get

func (m *TaskManager) Get(k string) (*types.Task, bool)

func (*TaskManager) Set

func (m *TaskManager) Set(k string, task *types.Task) *types.Task

func (*TaskManager) Touch

func (m *TaskManager) Touch(k string)

Jump to

Keyboard shortcuts

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