scheduler

package
v2.0.2-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_pkg_rpc_scheduler_scheduler_proto protoreflect.FileDescriptor

Functions

func RegisterSchedulerServer

func RegisterSchedulerServer(s grpc.ServiceRegistrar, srv SchedulerServer)

Types

type PeerHost

type PeerHost struct {

	// each time the daemon starts, it will generate a different uuid
	Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
	// peer host ip
	Ip string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"`
	// rpc service port for peer
	RpcPort int32 `protobuf:"varint,3,opt,name=rpc_port,json=rpcPort,proto3" json:"rpc_port,omitempty"`
	// piece downloading port for peer
	DownPort int32 `protobuf:"varint,4,opt,name=down_port,json=downPort,proto3" json:"down_port,omitempty"`
	// peer host name
	HostName string `protobuf:"bytes,5,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"`
	// security isolation domain for network
	SecurityDomain string `protobuf:"bytes,6,opt,name=security_domain,json=securityDomain,proto3" json:"security_domain,omitempty"`
	// location path: area|country|province|city|...
	Location string `protobuf:"bytes,7,opt,name=location,proto3" json:"location,omitempty"`
	// idc where the peer host is located
	Idc string `protobuf:"bytes,8,opt,name=idc,proto3" json:"idc,omitempty"`
	// network device path: switch|router|...
	NetTopology string `protobuf:"bytes,9,opt,name=net_topology,json=netTopology,proto3" json:"net_topology,omitempty"`
	// contains filtered or unexported fields
}

func (*PeerHost) Descriptor deprecated

func (*PeerHost) Descriptor() ([]byte, []int)

Deprecated: Use PeerHost.ProtoReflect.Descriptor instead.

func (*PeerHost) GetDownPort

func (x *PeerHost) GetDownPort() int32

func (*PeerHost) GetHostName

func (x *PeerHost) GetHostName() string

func (*PeerHost) GetIdc

func (x *PeerHost) GetIdc() string

func (*PeerHost) GetIp

func (x *PeerHost) GetIp() string

func (*PeerHost) GetLocation

func (x *PeerHost) GetLocation() string

func (*PeerHost) GetNetTopology

func (x *PeerHost) GetNetTopology() string

func (*PeerHost) GetRpcPort

func (x *PeerHost) GetRpcPort() int32

func (*PeerHost) GetSecurityDomain

func (x *PeerHost) GetSecurityDomain() string

func (*PeerHost) GetUuid

func (x *PeerHost) GetUuid() string

func (*PeerHost) ProtoMessage

func (*PeerHost) ProtoMessage()

func (*PeerHost) ProtoReflect

func (x *PeerHost) ProtoReflect() protoreflect.Message

func (*PeerHost) Reset

func (x *PeerHost) Reset()

func (*PeerHost) String

func (x *PeerHost) String() string

func (*PeerHost) Validate

func (m *PeerHost) Validate() error

Validate checks the field values on PeerHost with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*PeerHost) ValidateAll added in v2.0.1

func (m *PeerHost) ValidateAll() error

ValidateAll checks the field values on PeerHost with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PeerHostMultiError, or nil if none found.

type PeerHostMultiError added in v2.0.1

type PeerHostMultiError []error

PeerHostMultiError is an error wrapping multiple validation errors returned by PeerHost.ValidateAll() if the designated constraints aren't met.

func (PeerHostMultiError) AllErrors added in v2.0.1

func (m PeerHostMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PeerHostMultiError) Error added in v2.0.1

func (m PeerHostMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type PeerHostValidationError

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

PeerHostValidationError is the validation error returned by PeerHost.Validate if the designated constraints aren't met.

func (PeerHostValidationError) Cause

func (e PeerHostValidationError) Cause() error

Cause function returns cause value.

func (PeerHostValidationError) Error

func (e PeerHostValidationError) Error() string

Error satisfies the builtin error interface

func (PeerHostValidationError) ErrorName

func (e PeerHostValidationError) ErrorName() string

ErrorName returns error name.

func (PeerHostValidationError) Field

func (e PeerHostValidationError) Field() string

Field function returns field value.

func (PeerHostValidationError) Key

func (e PeerHostValidationError) Key() bool

Key function returns key value.

func (PeerHostValidationError) Reason

func (e PeerHostValidationError) Reason() string

Reason function returns reason value.

type PeerPacket

type PeerPacket struct {
	TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
	// source peer id
	SrcPid string `protobuf:"bytes,3,opt,name=src_pid,json=srcPid,proto3" json:"src_pid,omitempty"`
	// concurrent downloading count from main peer
	ParallelCount int32                  `protobuf:"varint,4,opt,name=parallel_count,json=parallelCount,proto3" json:"parallel_count,omitempty"`
	MainPeer      *PeerPacket_DestPeer   `protobuf:"bytes,5,opt,name=main_peer,json=mainPeer,proto3" json:"main_peer,omitempty"`
	StealPeers    []*PeerPacket_DestPeer `protobuf:"bytes,6,rep,name=steal_peers,json=stealPeers,proto3" json:"steal_peers,omitempty"`
	// result code
	Code base.Code `protobuf:"varint,7,opt,name=code,proto3,enum=base.Code" json:"code,omitempty"`
	// contains filtered or unexported fields
}

func (*PeerPacket) Descriptor deprecated

func (*PeerPacket) Descriptor() ([]byte, []int)

Deprecated: Use PeerPacket.ProtoReflect.Descriptor instead.

func (*PeerPacket) GetCode

func (x *PeerPacket) GetCode() base.Code

func (*PeerPacket) GetMainPeer

func (x *PeerPacket) GetMainPeer() *PeerPacket_DestPeer

func (*PeerPacket) GetParallelCount

func (x *PeerPacket) GetParallelCount() int32

func (*PeerPacket) GetSrcPid

func (x *PeerPacket) GetSrcPid() string

func (*PeerPacket) GetStealPeers

func (x *PeerPacket) GetStealPeers() []*PeerPacket_DestPeer

func (*PeerPacket) GetTaskId

func (x *PeerPacket) GetTaskId() string

func (*PeerPacket) ProtoMessage

func (*PeerPacket) ProtoMessage()

func (*PeerPacket) ProtoReflect

func (x *PeerPacket) ProtoReflect() protoreflect.Message

func (*PeerPacket) Reset

func (x *PeerPacket) Reset()

func (*PeerPacket) String

func (x *PeerPacket) String() string

func (*PeerPacket) Validate

func (m *PeerPacket) Validate() error

Validate checks the field values on PeerPacket with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*PeerPacket) ValidateAll added in v2.0.1

func (m *PeerPacket) ValidateAll() error

ValidateAll checks the field values on PeerPacket with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PeerPacketMultiError, or nil if none found.

type PeerPacketMultiError added in v2.0.1

type PeerPacketMultiError []error

PeerPacketMultiError is an error wrapping multiple validation errors returned by PeerPacket.ValidateAll() if the designated constraints aren't met.

func (PeerPacketMultiError) AllErrors added in v2.0.1

func (m PeerPacketMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PeerPacketMultiError) Error added in v2.0.1

func (m PeerPacketMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type PeerPacketValidationError

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

PeerPacketValidationError is the validation error returned by PeerPacket.Validate if the designated constraints aren't met.

func (PeerPacketValidationError) Cause

func (e PeerPacketValidationError) Cause() error

Cause function returns cause value.

func (PeerPacketValidationError) Error

Error satisfies the builtin error interface

func (PeerPacketValidationError) ErrorName

func (e PeerPacketValidationError) ErrorName() string

ErrorName returns error name.

func (PeerPacketValidationError) Field

Field function returns field value.

func (PeerPacketValidationError) Key

Key function returns key value.

func (PeerPacketValidationError) Reason

func (e PeerPacketValidationError) Reason() string

Reason function returns reason value.

type PeerPacket_DestPeer

type PeerPacket_DestPeer struct {

	// dest ip
	Ip string `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"`
	// rpc service port for dest peer
	RpcPort int32 `protobuf:"varint,2,opt,name=rpc_port,json=rpcPort,proto3" json:"rpc_port,omitempty"`
	// dest peer id
	PeerId string `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	// contains filtered or unexported fields
}

func (*PeerPacket_DestPeer) Descriptor deprecated

func (*PeerPacket_DestPeer) Descriptor() ([]byte, []int)

Deprecated: Use PeerPacket_DestPeer.ProtoReflect.Descriptor instead.

func (*PeerPacket_DestPeer) GetIp

func (x *PeerPacket_DestPeer) GetIp() string

func (*PeerPacket_DestPeer) GetPeerId

func (x *PeerPacket_DestPeer) GetPeerId() string

func (*PeerPacket_DestPeer) GetRpcPort

func (x *PeerPacket_DestPeer) GetRpcPort() int32

func (*PeerPacket_DestPeer) ProtoMessage

func (*PeerPacket_DestPeer) ProtoMessage()

func (*PeerPacket_DestPeer) ProtoReflect

func (x *PeerPacket_DestPeer) ProtoReflect() protoreflect.Message

func (*PeerPacket_DestPeer) Reset

func (x *PeerPacket_DestPeer) Reset()

func (*PeerPacket_DestPeer) String

func (x *PeerPacket_DestPeer) String() string

func (*PeerPacket_DestPeer) Validate

func (m *PeerPacket_DestPeer) Validate() error

Validate checks the field values on PeerPacket_DestPeer with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*PeerPacket_DestPeer) ValidateAll added in v2.0.1

func (m *PeerPacket_DestPeer) ValidateAll() error

ValidateAll checks the field values on PeerPacket_DestPeer with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PeerPacket_DestPeerMultiError, or nil if none found.

type PeerPacket_DestPeerMultiError added in v2.0.1

type PeerPacket_DestPeerMultiError []error

PeerPacket_DestPeerMultiError is an error wrapping multiple validation errors returned by PeerPacket_DestPeer.ValidateAll() if the designated constraints aren't met.

func (PeerPacket_DestPeerMultiError) AllErrors added in v2.0.1

func (m PeerPacket_DestPeerMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PeerPacket_DestPeerMultiError) Error added in v2.0.1

Error returns a concatenation of all the error messages it wraps.

type PeerPacket_DestPeerValidationError

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

PeerPacket_DestPeerValidationError is the validation error returned by PeerPacket_DestPeer.Validate if the designated constraints aren't met.

func (PeerPacket_DestPeerValidationError) Cause

Cause function returns cause value.

func (PeerPacket_DestPeerValidationError) Error

Error satisfies the builtin error interface

func (PeerPacket_DestPeerValidationError) ErrorName

ErrorName returns error name.

func (PeerPacket_DestPeerValidationError) Field

Field function returns field value.

func (PeerPacket_DestPeerValidationError) Key

Key function returns key value.

func (PeerPacket_DestPeerValidationError) Reason

Reason function returns reason value.

type PeerResult

type PeerResult struct {
	TaskId         string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
	PeerId         string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	SrcIp          string `protobuf:"bytes,3,opt,name=src_ip,json=srcIp,proto3" json:"src_ip,omitempty"`
	SecurityDomain string `protobuf:"bytes,4,opt,name=security_domain,json=securityDomain,proto3" json:"security_domain,omitempty"`
	Idc            string `protobuf:"bytes,5,opt,name=idc,proto3" json:"idc,omitempty"`
	Url            string `protobuf:"bytes,6,opt,name=url,proto3" json:"url,omitempty"`
	// total content length(byte)
	ContentLength int64 `protobuf:"varint,7,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"`
	// total network traffic(byte)
	Traffic uint64 `protobuf:"varint,8,opt,name=traffic,proto3" json:"traffic,omitempty"`
	// total time(millisecond) consumed
	Cost uint32 `protobuf:"varint,9,opt,name=cost,proto3" json:"cost,omitempty"`
	// whether peer downloading file is successfully
	Success bool `protobuf:"varint,10,opt,name=success,proto3" json:"success,omitempty"`
	// result code
	Code base.Code `protobuf:"varint,11,opt,name=code,proto3,enum=base.Code" json:"code,omitempty"`
	// -1 represent task is running or download failed
	TotalPieceCount int32 `protobuf:"varint,12,opt,name=total_piece_count,json=totalPieceCount,proto3" json:"total_piece_count,omitempty"`
	// contains filtered or unexported fields
}

func (*PeerResult) Descriptor deprecated

func (*PeerResult) Descriptor() ([]byte, []int)

Deprecated: Use PeerResult.ProtoReflect.Descriptor instead.

func (*PeerResult) GetCode

func (x *PeerResult) GetCode() base.Code

func (*PeerResult) GetContentLength

func (x *PeerResult) GetContentLength() int64

func (*PeerResult) GetCost

func (x *PeerResult) GetCost() uint32

func (*PeerResult) GetIdc

func (x *PeerResult) GetIdc() string

func (*PeerResult) GetPeerId

func (x *PeerResult) GetPeerId() string

func (*PeerResult) GetSecurityDomain

func (x *PeerResult) GetSecurityDomain() string

func (*PeerResult) GetSrcIp

func (x *PeerResult) GetSrcIp() string

func (*PeerResult) GetSuccess

func (x *PeerResult) GetSuccess() bool

func (*PeerResult) GetTaskId

func (x *PeerResult) GetTaskId() string

func (*PeerResult) GetTotalPieceCount

func (x *PeerResult) GetTotalPieceCount() int32

func (*PeerResult) GetTraffic

func (x *PeerResult) GetTraffic() uint64

func (*PeerResult) GetUrl

func (x *PeerResult) GetUrl() string

func (*PeerResult) ProtoMessage

func (*PeerResult) ProtoMessage()

func (*PeerResult) ProtoReflect

func (x *PeerResult) ProtoReflect() protoreflect.Message

func (*PeerResult) Reset

func (x *PeerResult) Reset()

func (*PeerResult) String

func (x *PeerResult) String() string

func (*PeerResult) Validate

func (m *PeerResult) Validate() error

Validate checks the field values on PeerResult with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*PeerResult) ValidateAll added in v2.0.1

func (m *PeerResult) ValidateAll() error

ValidateAll checks the field values on PeerResult with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PeerResultMultiError, or nil if none found.

type PeerResultMultiError added in v2.0.1

type PeerResultMultiError []error

PeerResultMultiError is an error wrapping multiple validation errors returned by PeerResult.ValidateAll() if the designated constraints aren't met.

func (PeerResultMultiError) AllErrors added in v2.0.1

func (m PeerResultMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PeerResultMultiError) Error added in v2.0.1

func (m PeerResultMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type PeerResultValidationError

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

PeerResultValidationError is the validation error returned by PeerResult.Validate if the designated constraints aren't met.

func (PeerResultValidationError) Cause

func (e PeerResultValidationError) Cause() error

Cause function returns cause value.

func (PeerResultValidationError) Error

Error satisfies the builtin error interface

func (PeerResultValidationError) ErrorName

func (e PeerResultValidationError) ErrorName() string

ErrorName returns error name.

func (PeerResultValidationError) Field

Field function returns field value.

func (PeerResultValidationError) Key

Key function returns key value.

func (PeerResultValidationError) Reason

func (e PeerResultValidationError) Reason() string

Reason function returns reason value.

type PeerTarget

type PeerTarget struct {
	TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
	PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	// contains filtered or unexported fields
}

func (*PeerTarget) Descriptor deprecated

func (*PeerTarget) Descriptor() ([]byte, []int)

Deprecated: Use PeerTarget.ProtoReflect.Descriptor instead.

func (*PeerTarget) GetPeerId

func (x *PeerTarget) GetPeerId() string

func (*PeerTarget) GetTaskId

func (x *PeerTarget) GetTaskId() string

func (*PeerTarget) ProtoMessage

func (*PeerTarget) ProtoMessage()

func (*PeerTarget) ProtoReflect

func (x *PeerTarget) ProtoReflect() protoreflect.Message

func (*PeerTarget) Reset

func (x *PeerTarget) Reset()

func (*PeerTarget) String

func (x *PeerTarget) String() string

func (*PeerTarget) Validate

func (m *PeerTarget) Validate() error

Validate checks the field values on PeerTarget with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*PeerTarget) ValidateAll added in v2.0.1

func (m *PeerTarget) ValidateAll() error

ValidateAll checks the field values on PeerTarget with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PeerTargetMultiError, or nil if none found.

type PeerTargetMultiError added in v2.0.1

type PeerTargetMultiError []error

PeerTargetMultiError is an error wrapping multiple validation errors returned by PeerTarget.ValidateAll() if the designated constraints aren't met.

func (PeerTargetMultiError) AllErrors added in v2.0.1

func (m PeerTargetMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PeerTargetMultiError) Error added in v2.0.1

func (m PeerTargetMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type PeerTargetValidationError

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

PeerTargetValidationError is the validation error returned by PeerTarget.Validate if the designated constraints aren't met.

func (PeerTargetValidationError) Cause

func (e PeerTargetValidationError) Cause() error

Cause function returns cause value.

func (PeerTargetValidationError) Error

Error satisfies the builtin error interface

func (PeerTargetValidationError) ErrorName

func (e PeerTargetValidationError) ErrorName() string

ErrorName returns error name.

func (PeerTargetValidationError) Field

Field function returns field value.

func (PeerTargetValidationError) Key

Key function returns key value.

func (PeerTargetValidationError) Reason

func (e PeerTargetValidationError) Reason() string

Reason function returns reason value.

type PeerTaskRequest

type PeerTaskRequest struct {

	// universal resource locator for different kind of storage
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// url meta info
	UrlMeta *base.UrlMeta `protobuf:"bytes,2,opt,name=url_meta,json=urlMeta,proto3" json:"url_meta,omitempty"`
	// peer's id and must be global uniqueness
	PeerId string `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	// peer host info
	PeerHost *PeerHost `protobuf:"bytes,4,opt,name=peer_host,json=peerHost,proto3" json:"peer_host,omitempty"`
	// current host load
	HostLoad *base.HostLoad `protobuf:"bytes,5,opt,name=host_load,json=hostLoad,proto3" json:"host_load,omitempty"`
	// whether this request is caused by migration
	IsMigrating bool `protobuf:"varint,6,opt,name=is_migrating,json=isMigrating,proto3" json:"is_migrating,omitempty"`
	// contains filtered or unexported fields
}

func (*PeerTaskRequest) Descriptor deprecated

func (*PeerTaskRequest) Descriptor() ([]byte, []int)

Deprecated: Use PeerTaskRequest.ProtoReflect.Descriptor instead.

func (*PeerTaskRequest) GetHostLoad

func (x *PeerTaskRequest) GetHostLoad() *base.HostLoad

func (*PeerTaskRequest) GetIsMigrating

func (x *PeerTaskRequest) GetIsMigrating() bool

func (*PeerTaskRequest) GetPeerHost

func (x *PeerTaskRequest) GetPeerHost() *PeerHost

func (*PeerTaskRequest) GetPeerId

func (x *PeerTaskRequest) GetPeerId() string

func (*PeerTaskRequest) GetUrl

func (x *PeerTaskRequest) GetUrl() string

func (*PeerTaskRequest) GetUrlMeta

func (x *PeerTaskRequest) GetUrlMeta() *base.UrlMeta

func (*PeerTaskRequest) ProtoMessage

func (*PeerTaskRequest) ProtoMessage()

func (*PeerTaskRequest) ProtoReflect

func (x *PeerTaskRequest) ProtoReflect() protoreflect.Message

func (*PeerTaskRequest) Reset

func (x *PeerTaskRequest) Reset()

func (*PeerTaskRequest) String

func (x *PeerTaskRequest) String() string

func (*PeerTaskRequest) Validate

func (m *PeerTaskRequest) Validate() error

Validate checks the field values on PeerTaskRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*PeerTaskRequest) ValidateAll added in v2.0.1

func (m *PeerTaskRequest) ValidateAll() error

ValidateAll checks the field values on PeerTaskRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PeerTaskRequestMultiError, or nil if none found.

type PeerTaskRequestMultiError added in v2.0.1

type PeerTaskRequestMultiError []error

PeerTaskRequestMultiError is an error wrapping multiple validation errors returned by PeerTaskRequest.ValidateAll() if the designated constraints aren't met.

func (PeerTaskRequestMultiError) AllErrors added in v2.0.1

func (m PeerTaskRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PeerTaskRequestMultiError) Error added in v2.0.1

Error returns a concatenation of all the error messages it wraps.

type PeerTaskRequestValidationError

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

PeerTaskRequestValidationError is the validation error returned by PeerTaskRequest.Validate if the designated constraints aren't met.

func (PeerTaskRequestValidationError) Cause

Cause function returns cause value.

func (PeerTaskRequestValidationError) Error

Error satisfies the builtin error interface

func (PeerTaskRequestValidationError) ErrorName

func (e PeerTaskRequestValidationError) ErrorName() string

ErrorName returns error name.

func (PeerTaskRequestValidationError) Field

Field function returns field value.

func (PeerTaskRequestValidationError) Key

Key function returns key value.

func (PeerTaskRequestValidationError) Reason

Reason function returns reason value.

type PieceResult

type PieceResult struct {

	// task id
	TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
	// source peer id
	SrcPid string `protobuf:"bytes,2,opt,name=src_pid,json=srcPid,proto3" json:"src_pid,omitempty"`
	// dest peer id
	DstPid string `protobuf:"bytes,3,opt,name=dst_pid,json=dstPid,proto3" json:"dst_pid,omitempty"`
	// piece info
	PieceInfo *base.PieceInfo `protobuf:"bytes,4,opt,name=piece_info,json=pieceInfo,proto3" json:"piece_info,omitempty"`
	// begin time for the piece downloading
	BeginTime uint64 `protobuf:"varint,5,opt,name=begin_time,json=beginTime,proto3" json:"begin_time,omitempty"`
	// end time for the piece downloading
	EndTime uint64 `protobuf:"varint,6,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
	// whether the piece downloading is successfully
	Success bool `protobuf:"varint,7,opt,name=success,proto3" json:"success,omitempty"`
	// result code
	Code base.Code `protobuf:"varint,8,opt,name=code,proto3,enum=base.Code" json:"code,omitempty"`
	// current host resource usage
	HostLoad *base.HostLoad `protobuf:"bytes,9,opt,name=host_load,json=hostLoad,proto3" json:"host_load,omitempty"`
	// currently completed piece count, -1 represent download failed
	FinishedCount int32 `protobuf:"varint,10,opt,name=finished_count,json=finishedCount,proto3" json:"finished_count,omitempty"`
	// contains filtered or unexported fields
}

func NewEndPieceResult

func NewEndPieceResult(taskID, peerID string, finishedCount int32) *PieceResult

func NewZeroPieceResult

func NewZeroPieceResult(taskID, peerID string) *PieceResult

func (*PieceResult) Descriptor deprecated

func (*PieceResult) Descriptor() ([]byte, []int)

Deprecated: Use PieceResult.ProtoReflect.Descriptor instead.

func (*PieceResult) GetBeginTime

func (x *PieceResult) GetBeginTime() uint64

func (*PieceResult) GetCode

func (x *PieceResult) GetCode() base.Code

func (*PieceResult) GetDstPid

func (x *PieceResult) GetDstPid() string

func (*PieceResult) GetEndTime

func (x *PieceResult) GetEndTime() uint64

func (*PieceResult) GetFinishedCount

func (x *PieceResult) GetFinishedCount() int32

func (*PieceResult) GetHostLoad

func (x *PieceResult) GetHostLoad() *base.HostLoad

func (*PieceResult) GetPieceInfo

func (x *PieceResult) GetPieceInfo() *base.PieceInfo

func (*PieceResult) GetSrcPid

func (x *PieceResult) GetSrcPid() string

func (*PieceResult) GetSuccess

func (x *PieceResult) GetSuccess() bool

func (*PieceResult) GetTaskId

func (x *PieceResult) GetTaskId() string

func (*PieceResult) ProtoMessage

func (*PieceResult) ProtoMessage()

func (*PieceResult) ProtoReflect

func (x *PieceResult) ProtoReflect() protoreflect.Message

func (*PieceResult) Reset

func (x *PieceResult) Reset()

func (*PieceResult) String

func (x *PieceResult) String() string

func (*PieceResult) Validate

func (m *PieceResult) Validate() error

Validate checks the field values on PieceResult with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*PieceResult) ValidateAll added in v2.0.1

func (m *PieceResult) ValidateAll() error

ValidateAll checks the field values on PieceResult with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PieceResultMultiError, or nil if none found.

type PieceResultMultiError added in v2.0.1

type PieceResultMultiError []error

PieceResultMultiError is an error wrapping multiple validation errors returned by PieceResult.ValidateAll() if the designated constraints aren't met.

func (PieceResultMultiError) AllErrors added in v2.0.1

func (m PieceResultMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PieceResultMultiError) Error added in v2.0.1

func (m PieceResultMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type PieceResultValidationError

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

PieceResultValidationError is the validation error returned by PieceResult.Validate if the designated constraints aren't met.

func (PieceResultValidationError) Cause

Cause function returns cause value.

func (PieceResultValidationError) Error

Error satisfies the builtin error interface

func (PieceResultValidationError) ErrorName

func (e PieceResultValidationError) ErrorName() string

ErrorName returns error name.

func (PieceResultValidationError) Field

Field function returns field value.

func (PieceResultValidationError) Key

Key function returns key value.

func (PieceResultValidationError) Reason

Reason function returns reason value.

type RegisterResult

type RegisterResult struct {

	// task id
	TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
	// file content length scope for the url
	SizeScope base.SizeScope `protobuf:"varint,3,opt,name=size_scope,json=sizeScope,proto3,enum=base.SizeScope" json:"size_scope,omitempty"`
	// download the only piece directly for small or tiny file
	//
	// Types that are assignable to DirectPiece:
	//	*RegisterResult_SinglePiece
	//	*RegisterResult_PieceContent
	DirectPiece isRegisterResult_DirectPiece `protobuf_oneof:"direct_piece"`
	// contains filtered or unexported fields
}

func (*RegisterResult) Descriptor deprecated

func (*RegisterResult) Descriptor() ([]byte, []int)

Deprecated: Use RegisterResult.ProtoReflect.Descriptor instead.

func (*RegisterResult) GetDirectPiece

func (m *RegisterResult) GetDirectPiece() isRegisterResult_DirectPiece

func (*RegisterResult) GetPieceContent

func (x *RegisterResult) GetPieceContent() []byte

func (*RegisterResult) GetSinglePiece

func (x *RegisterResult) GetSinglePiece() *SinglePiece

func (*RegisterResult) GetSizeScope

func (x *RegisterResult) GetSizeScope() base.SizeScope

func (*RegisterResult) GetTaskId

func (x *RegisterResult) GetTaskId() string

func (*RegisterResult) ProtoMessage

func (*RegisterResult) ProtoMessage()

func (*RegisterResult) ProtoReflect

func (x *RegisterResult) ProtoReflect() protoreflect.Message

func (*RegisterResult) Reset

func (x *RegisterResult) Reset()

func (*RegisterResult) String

func (x *RegisterResult) String() string

func (*RegisterResult) Validate

func (m *RegisterResult) Validate() error

Validate checks the field values on RegisterResult with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*RegisterResult) ValidateAll added in v2.0.1

func (m *RegisterResult) ValidateAll() error

ValidateAll checks the field values on RegisterResult with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RegisterResultMultiError, or nil if none found.

type RegisterResultMultiError added in v2.0.1

type RegisterResultMultiError []error

RegisterResultMultiError is an error wrapping multiple validation errors returned by RegisterResult.ValidateAll() if the designated constraints aren't met.

func (RegisterResultMultiError) AllErrors added in v2.0.1

func (m RegisterResultMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RegisterResultMultiError) Error added in v2.0.1

func (m RegisterResultMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type RegisterResultValidationError

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

RegisterResultValidationError is the validation error returned by RegisterResult.Validate if the designated constraints aren't met.

func (RegisterResultValidationError) Cause

Cause function returns cause value.

func (RegisterResultValidationError) Error

Error satisfies the builtin error interface

func (RegisterResultValidationError) ErrorName

func (e RegisterResultValidationError) ErrorName() string

ErrorName returns error name.

func (RegisterResultValidationError) Field

Field function returns field value.

func (RegisterResultValidationError) Key

Key function returns key value.

func (RegisterResultValidationError) Reason

Reason function returns reason value.

type RegisterResult_PieceContent

type RegisterResult_PieceContent struct {
	// for tiny file
	PieceContent []byte `protobuf:"bytes,5,opt,name=piece_content,json=pieceContent,proto3,oneof"`
}

type RegisterResult_SinglePiece

type RegisterResult_SinglePiece struct {
	// for small file
	SinglePiece *SinglePiece `protobuf:"bytes,4,opt,name=single_piece,json=singlePiece,proto3,oneof"`
}

type SchedulerClient

type SchedulerClient interface {
	// RegisterPeerTask registers a peer into one task.
	RegisterPeerTask(ctx context.Context, in *PeerTaskRequest, opts ...grpc.CallOption) (*RegisterResult, error)
	// ReportPieceResult reports piece results and receives peer packets.
	// when migrating to another scheduler,
	// it will send the last piece result to the new scheduler.
	ReportPieceResult(ctx context.Context, opts ...grpc.CallOption) (Scheduler_ReportPieceResultClient, error)
	// ReportPeerResult reports downloading result for the peer task.
	ReportPeerResult(ctx context.Context, in *PeerResult, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// LeaveTask makes the peer leaving from scheduling overlay for the task.
	LeaveTask(ctx context.Context, in *PeerTarget, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

SchedulerClient is the client API for Scheduler service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewSchedulerClient

func NewSchedulerClient(cc grpc.ClientConnInterface) SchedulerClient

type SchedulerServer

type SchedulerServer interface {
	// RegisterPeerTask registers a peer into one task.
	RegisterPeerTask(context.Context, *PeerTaskRequest) (*RegisterResult, error)
	// ReportPieceResult reports piece results and receives peer packets.
	// when migrating to another scheduler,
	// it will send the last piece result to the new scheduler.
	ReportPieceResult(Scheduler_ReportPieceResultServer) error
	// ReportPeerResult reports downloading result for the peer task.
	ReportPeerResult(context.Context, *PeerResult) (*emptypb.Empty, error)
	// LeaveTask makes the peer leaving from scheduling overlay for the task.
	LeaveTask(context.Context, *PeerTarget) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

SchedulerServer is the server API for Scheduler service. All implementations must embed UnimplementedSchedulerServer for forward compatibility

type Scheduler_ReportPieceResultClient

type Scheduler_ReportPieceResultClient interface {
	Send(*PieceResult) error
	Recv() (*PeerPacket, error)
	grpc.ClientStream
}

type Scheduler_ReportPieceResultServer

type Scheduler_ReportPieceResultServer interface {
	Send(*PeerPacket) error
	Recv() (*PieceResult, error)
	grpc.ServerStream
}

type SinglePiece

type SinglePiece struct {

	// destination peer id
	DstPid string `protobuf:"bytes,1,opt,name=dst_pid,json=dstPid,proto3" json:"dst_pid,omitempty"`
	// download address(ip:port)
	DstAddr string `protobuf:"bytes,2,opt,name=dst_addr,json=dstAddr,proto3" json:"dst_addr,omitempty"`
	// one piece info
	PieceInfo *base.PieceInfo `protobuf:"bytes,3,opt,name=piece_info,json=pieceInfo,proto3" json:"piece_info,omitempty"`
	// contains filtered or unexported fields
}

func (*SinglePiece) Descriptor deprecated

func (*SinglePiece) Descriptor() ([]byte, []int)

Deprecated: Use SinglePiece.ProtoReflect.Descriptor instead.

func (*SinglePiece) GetDstAddr

func (x *SinglePiece) GetDstAddr() string

func (*SinglePiece) GetDstPid

func (x *SinglePiece) GetDstPid() string

func (*SinglePiece) GetPieceInfo

func (x *SinglePiece) GetPieceInfo() *base.PieceInfo

func (*SinglePiece) ProtoMessage

func (*SinglePiece) ProtoMessage()

func (*SinglePiece) ProtoReflect

func (x *SinglePiece) ProtoReflect() protoreflect.Message

func (*SinglePiece) Reset

func (x *SinglePiece) Reset()

func (*SinglePiece) String

func (x *SinglePiece) String() string

func (*SinglePiece) Validate

func (m *SinglePiece) Validate() error

Validate checks the field values on SinglePiece with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*SinglePiece) ValidateAll added in v2.0.1

func (m *SinglePiece) ValidateAll() error

ValidateAll checks the field values on SinglePiece with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in SinglePieceMultiError, or nil if none found.

type SinglePieceMultiError added in v2.0.1

type SinglePieceMultiError []error

SinglePieceMultiError is an error wrapping multiple validation errors returned by SinglePiece.ValidateAll() if the designated constraints aren't met.

func (SinglePieceMultiError) AllErrors added in v2.0.1

func (m SinglePieceMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SinglePieceMultiError) Error added in v2.0.1

func (m SinglePieceMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type SinglePieceValidationError

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

SinglePieceValidationError is the validation error returned by SinglePiece.Validate if the designated constraints aren't met.

func (SinglePieceValidationError) Cause

Cause function returns cause value.

func (SinglePieceValidationError) Error

Error satisfies the builtin error interface

func (SinglePieceValidationError) ErrorName

func (e SinglePieceValidationError) ErrorName() string

ErrorName returns error name.

func (SinglePieceValidationError) Field

Field function returns field value.

func (SinglePieceValidationError) Key

Key function returns key value.

func (SinglePieceValidationError) Reason

Reason function returns reason value.

type UnimplementedSchedulerServer

type UnimplementedSchedulerServer struct {
}

UnimplementedSchedulerServer must be embedded to have forward compatible implementations.

func (UnimplementedSchedulerServer) LeaveTask

func (UnimplementedSchedulerServer) RegisterPeerTask

func (UnimplementedSchedulerServer) ReportPeerResult

func (UnimplementedSchedulerServer) ReportPieceResult

type UnsafeSchedulerServer

type UnsafeSchedulerServer interface {
	// contains filtered or unexported methods
}

UnsafeSchedulerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SchedulerServer will result in compilation errors.

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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