Documentation ¶
Index ¶
- Constants
- type Host
- func (h *Host) AddDownloadLoad(delta int32)
- func (h *Host) AddPeerTask(peerTask *PeerTask)
- func (h *Host) AddUploadLoad(delta int32)
- func (h *Host) DeletePeerTask(peerTaskID string)
- func (h *Host) GetDownloadLoad() int32
- func (h *Host) GetDownloadLoadPercent() float64
- func (h *Host) GetFreeDownloadLoad() int32
- func (h *Host) GetFreeUploadLoad() int32
- func (h *Host) GetPeerTask(peerTaskID string) (peerTask *PeerTask)
- func (h *Host) GetPeerTaskNum() int32
- func (h *Host) GetUploadLoad() int32
- func (h *Host) GetUploadLoadPercent() float64
- func (h *Host) SetTotalDownloadLoad(load int32)
- func (h *Host) SetTotalUploadLoad(load int32)
- type HostType
- type IClient
- type PeerEdge
- type PeerTask
- func (pt *PeerTask) AddConcurrency(parent *PeerTask, delta int8)
- func (pt *PeerTask) AddParent(parent *PeerTask, concurrency int8)
- func (pt *PeerTask) AddPieceStatus(ps *scheduler.PieceResult)
- func (pt *PeerTask) DeleteParent()
- func (pt *PeerTask) GetChildren() (children []*PeerEdge)
- func (pt *PeerTask) GetCost() int64
- func (pt *PeerTask) GetDeep() int32
- func (pt *PeerTask) GetDiffPieceNum(dst *PeerTask) int32
- func (pt *PeerTask) GetFinishedNum() int32
- func (pt *PeerTask) GetFreeLoad() int32
- func (pt *PeerTask) GetJobData() interface{}
- func (pt *PeerTask) GetLastActiveTime() int64
- func (pt *PeerTask) GetNodeStatus() PeerTaskStatus
- func (pt *PeerTask) GetParent() *PeerEdge
- func (pt *PeerTask) GetRoot() *PeerTask
- func (pt *PeerTask) GetSendPkg() (pkg *scheduler.PeerPacket)
- func (pt *PeerTask) GetSortKeys() (key1, key2 int)
- func (pt *PeerTask) GetStartTime() int64
- func (pt *PeerTask) GetSubTreeNodesNum() int32
- func (pt *PeerTask) IsAncestor(a *PeerTask) bool
- func (pt *PeerTask) IsDown() (ok bool)
- func (pt *PeerTask) IsWaiting() bool
- func (pt *PeerTask) Send() error
- func (pt *PeerTask) SendError(dfError *dferrors.DfError) error
- func (pt *PeerTask) SetClient(client IClient)
- func (pt *PeerTask) SetDown()
- func (pt *PeerTask) SetNodeStatus(status PeerTaskStatus, data ...interface{})
- func (pt *PeerTask) SetNodeStatusHealth(swapStatus ...PeerTaskStatus)
- func (pt *PeerTask) SetStatus(traffic int64, cost uint32, success bool, code base.Code)
- func (pt *PeerTask) SetUp()
- func (pt *PeerTask) Touch()
- type PeerTaskStatus
- type Piece
- type Task
- type WaitingType
Constants ¶
View Source
const ( HostTypePeer = 1 HostTypeCdn = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Host ¶
type Host struct { scheduler.PeerHost Type HostType // peer / cdn // ServiceDownTime the down time of the peer service. ServiceDownTime int64 // contains filtered or unexported fields }
func (*Host) AddDownloadLoad ¶
func (*Host) AddPeerTask ¶
func (*Host) AddUploadLoad ¶
func (*Host) DeletePeerTask ¶
func (*Host) GetDownloadLoad ¶
func (*Host) GetDownloadLoadPercent ¶
func (*Host) GetFreeDownloadLoad ¶
func (*Host) GetFreeUploadLoad ¶
func (*Host) GetPeerTask ¶
func (*Host) GetPeerTaskNum ¶
func (*Host) GetUploadLoad ¶
func (*Host) GetUploadLoadPercent ¶
func (*Host) SetTotalDownloadLoad ¶
func (*Host) SetTotalUploadLoad ¶
type IClient ¶
type IClient interface { Send(*scheduler.PeerPacket) error Recv() (*scheduler.PieceResult, error) Close() IsClosed() bool }
type PeerEdge ¶
type PeerTask ¶
type PeerTask struct { Pid string // peer id Task *Task // task info Host *Host // host info Traffic int64 Cost uint32 Success bool Code base.Code // contains filtered or unexported fields }
func NewPeerTask ¶
func (*PeerTask) AddConcurrency ¶
func (*PeerTask) AddPieceStatus ¶
func (pt *PeerTask) AddPieceStatus(ps *scheduler.PieceResult)
func (*PeerTask) DeleteParent ¶
func (pt *PeerTask) DeleteParent()
func (*PeerTask) GetChildren ¶
func (*PeerTask) GetDiffPieceNum ¶
func (*PeerTask) GetFinishedNum ¶
func (*PeerTask) GetFreeLoad ¶
func (*PeerTask) GetJobData ¶
func (pt *PeerTask) GetJobData() interface{}
func (*PeerTask) GetLastActiveTime ¶
func (*PeerTask) GetNodeStatus ¶
func (pt *PeerTask) GetNodeStatus() PeerTaskStatus
func (*PeerTask) GetSendPkg ¶
func (pt *PeerTask) GetSendPkg() (pkg *scheduler.PeerPacket)
func (*PeerTask) GetSortKeys ¶
func (*PeerTask) GetStartTime ¶
func (*PeerTask) GetSubTreeNodesNum ¶
func (*PeerTask) IsAncestor ¶
func (*PeerTask) SetNodeStatus ¶
func (pt *PeerTask) SetNodeStatus(status PeerTaskStatus, data ...interface{})
func (*PeerTask) SetNodeStatusHealth ¶
func (pt *PeerTask) SetNodeStatusHealth(swapStatus ...PeerTaskStatus)
type PeerTaskStatus ¶
type PeerTaskStatus int8
const ( PeerTaskStatusHealth PeerTaskStatus = 0 PeerTaskStatusBadNode PeerTaskStatus = 11 PeerTaskStatusNodeGone PeerTaskStatus = 12 PeerTaskStatusNeedCheckNode PeerTaskStatus = 13 PeerTaskStatusNeedAdjustNode PeerTaskStatus = 21 PeerTaskStatusNeedChildren PeerTaskStatus = 22 PeerTaskStatusNeedParent PeerTaskStatus = 23 PeerTaskStatusAddParent PeerTaskStatus = 24 PeerTaskStatusDone PeerTaskStatus = 31 PeerTaskStatusLeaveNode PeerTaskStatus = 32 )
type Task ¶
type Task struct { TaskID string `json:"task_id,omitempty"` URL string `json:"url,omitempty"` // regex format, used for task id generator, assimilating different urls Filter string `json:"filter,omitempty"` // biz_id and md5 are used for task id generator to distinguish the same urls // md5 is also used to check consistency about file content BizID string `json:"biz_id,omitempty"` // caller's biz id that can be any string URLMata *base.UrlMeta `json:"url_mata,omitempty"` // downloaded file content md5 SizeScope base.SizeScope DirectPiece *scheduler.RegisterResult_PieceContent CreateTime time.Time LastActive time.Time PieceList map[int32]*Piece // Piece list PieceTotal int32 // the total number of Pieces, set > 0 when cdn finished ContentLength int64 Statistic *metrics.TaskStatistic Removed bool CDNError *dferrors.DfError // contains filtered or unexported fields }
func (*Task) GetOrCreatePiece ¶
type WaitingType ¶
type WaitingType int
Click to show internal directories.
Click to hide internal directories.