common

package
v1.5.9 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 19 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SizeScope_name = map[int32]string{
		0: "NORMAL",
		1: "SMALL",
		2: "TINY",
		3: "EMPTY",
		4: "UNKNOW",
	}
	SizeScope_value = map[string]int32{
		"NORMAL": 0,
		"SMALL":  1,
		"TINY":   2,
		"EMPTY":  3,
		"UNKNOW": 4,
	}
)

Enum value maps for SizeScope.

View Source
var (
	TaskType_name = map[int32]string{
		0: "DFDAEMON",
		1: "DFCACHE",
		2: "DFSTORE",
	}
	TaskType_value = map[string]int32{
		"DFDAEMON": 0,
		"DFCACHE":  1,
		"DFSTORE":  2,
	}
)

Enum value maps for TaskType.

View Source
var (
	TrafficType_name = map[int32]string{
		0: "BACK_TO_SOURCE",
		1: "REMOTE_PEER",
		2: "LOCAL_PEER",
	}
	TrafficType_value = map[string]int32{
		"BACK_TO_SOURCE": 0,
		"REMOTE_PEER":    1,
		"LOCAL_PEER":     2,
	}
)

Enum value maps for TrafficType.

View Source
var (
	Priority_name = map[int32]string{
		0: "LEVEL0",
		1: "LEVEL1",
		2: "LEVEL2",
		3: "LEVEL3",
		4: "LEVEL4",
		5: "LEVEL5",
		6: "LEVEL6",
	}
	Priority_value = map[string]int32{
		"LEVEL0": 0,
		"LEVEL1": 1,
		"LEVEL2": 2,
		"LEVEL3": 3,
		"LEVEL4": 4,
		"LEVEL5": 5,
		"LEVEL6": 6,
	}
)

Enum value maps for Priority.

View Source
var File_pkg_apis_common_v2_common_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Download added in v1.5.0

type Download struct {

	// Download url.
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// Digest of the pieces digest, for example md5:xxx or sha256:yyy.
	Digest string `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"`
	// Range is url range of request.
	Range *Range `protobuf:"bytes,3,opt,name=range,proto3" json:"range,omitempty"`
	// Task type.
	Type TaskType `protobuf:"varint,4,opt,name=type,proto3,enum=common.v2.TaskType" json:"type,omitempty"`
	// URL tag identifies different task for same url.
	Tag string `protobuf:"bytes,5,opt,name=tag,proto3" json:"tag,omitempty"`
	// Application of task.
	Application string `protobuf:"bytes,6,opt,name=application,proto3" json:"application,omitempty"`
	// Peer priority.
	Priority Priority `protobuf:"varint,7,opt,name=priority,proto3,enum=common.v2.Priority" json:"priority,omitempty"`
	// Filter url used to generate task id.
	Filters []string `protobuf:"bytes,8,rep,name=filters,proto3" json:"filters,omitempty"`
	// Task request headers.
	Header map[string]string `` /* 153-byte string literal not displayed */
	// Task piece length.
	PieceLength int32 `protobuf:"varint,10,opt,name=piece_length,json=pieceLength,proto3" json:"piece_length,omitempty"`
	// File path to be exported.
	OutputPath string `protobuf:"bytes,11,opt,name=output_path,json=outputPath,proto3" json:"output_path,omitempty"`
	// Download timeout.
	Timeout *durationpb.Duration `protobuf:"bytes,12,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// Download rate limit in bytes per second.
	DownloadRateLimit float64 `protobuf:"fixed64,13,opt,name=download_rate_limit,json=downloadRateLimit,proto3" json:"download_rate_limit,omitempty"`
	// NeedBackToSource needs downloaded from source.
	NeedBackToSource bool `protobuf:"varint,14,opt,name=need_back_to_source,json=needBackToSource,proto3" json:"need_back_to_source,omitempty"`
	// contains filtered or unexported fields
}

Download information.

func (*Download) Descriptor deprecated added in v1.5.0

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

Deprecated: Use Download.ProtoReflect.Descriptor instead.

func (*Download) GetApplication added in v1.5.0

func (x *Download) GetApplication() string

func (*Download) GetDigest added in v1.5.0

func (x *Download) GetDigest() string

func (*Download) GetDownloadRateLimit added in v1.5.0

func (x *Download) GetDownloadRateLimit() float64

func (*Download) GetFilters added in v1.5.0

func (x *Download) GetFilters() []string

func (*Download) GetHeader added in v1.5.0

func (x *Download) GetHeader() map[string]string

func (*Download) GetNeedBackToSource added in v1.5.0

func (x *Download) GetNeedBackToSource() bool

func (*Download) GetOutputPath added in v1.5.0

func (x *Download) GetOutputPath() string

func (*Download) GetPieceLength added in v1.5.2

func (x *Download) GetPieceLength() int32

func (*Download) GetPriority added in v1.5.0

func (x *Download) GetPriority() Priority

func (*Download) GetRange added in v1.5.0

func (x *Download) GetRange() *Range

func (*Download) GetTag added in v1.5.0

func (x *Download) GetTag() string

func (*Download) GetTimeout added in v1.5.0

func (x *Download) GetTimeout() *durationpb.Duration

func (*Download) GetType added in v1.5.0

func (x *Download) GetType() TaskType

func (*Download) GetUrl added in v1.5.0

func (x *Download) GetUrl() string

func (*Download) ProtoMessage added in v1.5.0

func (*Download) ProtoMessage()

func (*Download) ProtoReflect added in v1.5.0

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

func (*Download) Reset added in v1.5.0

func (x *Download) Reset()

func (*Download) String added in v1.5.0

func (x *Download) String() string

func (*Download) Validate added in v1.5.0

func (m *Download) Validate() error

Validate checks the field values on Download 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 (*Download) ValidateAll added in v1.5.0

func (m *Download) ValidateAll() error

ValidateAll checks the field values on Download 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 DownloadMultiError, or nil if none found.

type DownloadMultiError added in v1.5.0

type DownloadMultiError []error

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

func (DownloadMultiError) AllErrors added in v1.5.0

func (m DownloadMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (DownloadMultiError) Error added in v1.5.0

func (m DownloadMultiError) Error() string

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

type DownloadValidationError added in v1.5.0

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

DownloadValidationError is the validation error returned by Download.Validate if the designated constraints aren't met.

func (DownloadValidationError) Cause added in v1.5.0

func (e DownloadValidationError) Cause() error

Cause function returns cause value.

func (DownloadValidationError) Error added in v1.5.0

func (e DownloadValidationError) Error() string

Error satisfies the builtin error interface

func (DownloadValidationError) ErrorName added in v1.5.0

func (e DownloadValidationError) ErrorName() string

ErrorName returns error name.

func (DownloadValidationError) Field added in v1.5.0

func (e DownloadValidationError) Field() string

Field function returns field value.

func (DownloadValidationError) Key added in v1.5.0

func (e DownloadValidationError) Key() bool

Key function returns key value.

func (DownloadValidationError) Reason added in v1.5.0

func (e DownloadValidationError) Reason() string

Reason function returns reason value.

type ExtendAttribute

type ExtendAttribute struct {

	// Task response header, eg: HTTP Response Header
	Header map[string]string `` /* 153-byte string literal not displayed */
	// Task response code, eg: HTTP Status Code
	StatusCode int32 `protobuf:"varint,2,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
	// Task response status, eg: HTTP Status
	Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

ExtendAttribute represents extend of attribution.

func (*ExtendAttribute) Descriptor deprecated

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

Deprecated: Use ExtendAttribute.ProtoReflect.Descriptor instead.

func (*ExtendAttribute) GetHeader

func (x *ExtendAttribute) GetHeader() map[string]string

func (*ExtendAttribute) GetStatus

func (x *ExtendAttribute) GetStatus() string

func (*ExtendAttribute) GetStatusCode

func (x *ExtendAttribute) GetStatusCode() int32

func (*ExtendAttribute) ProtoMessage

func (*ExtendAttribute) ProtoMessage()

func (*ExtendAttribute) ProtoReflect

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

func (*ExtendAttribute) Reset

func (x *ExtendAttribute) Reset()

func (*ExtendAttribute) String

func (x *ExtendAttribute) String() string

func (*ExtendAttribute) Validate

func (m *ExtendAttribute) Validate() error

Validate checks the field values on ExtendAttribute 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 (*ExtendAttribute) ValidateAll

func (m *ExtendAttribute) ValidateAll() error

ValidateAll checks the field values on ExtendAttribute 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 ExtendAttributeMultiError, or nil if none found.

type ExtendAttributeMultiError

type ExtendAttributeMultiError []error

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

func (ExtendAttributeMultiError) AllErrors

func (m ExtendAttributeMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ExtendAttributeMultiError) Error

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

type ExtendAttributeValidationError

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

ExtendAttributeValidationError is the validation error returned by ExtendAttribute.Validate if the designated constraints aren't met.

func (ExtendAttributeValidationError) Cause

Cause function returns cause value.

func (ExtendAttributeValidationError) Error

Error satisfies the builtin error interface

func (ExtendAttributeValidationError) ErrorName

func (e ExtendAttributeValidationError) ErrorName() string

ErrorName returns error name.

func (ExtendAttributeValidationError) Field

Field function returns field value.

func (ExtendAttributeValidationError) Key

Key function returns key value.

func (ExtendAttributeValidationError) Reason

Reason function returns reason value.

type Host added in v1.4.1

type Host struct {

	// Host id.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Host ip.
	Ip string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"`
	// Peer hostname.
	Hostname string `protobuf:"bytes,3,opt,name=hostname,proto3" json:"hostname,omitempty"`
	// Port of grpc service.
	Port int32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"`
	// Port of download server.
	DownloadPort int32 `protobuf:"varint,5,opt,name=download_port,json=downloadPort,proto3" json:"download_port,omitempty"`
	// Security domain for network.
	SecurityDomain string `protobuf:"bytes,6,opt,name=security_domain,json=securityDomain,proto3" json:"security_domain,omitempty"`
	// Host location, eg: 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"`
	// contains filtered or unexported fields
}

Host metadata.

func (*Host) Descriptor deprecated added in v1.4.1

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

Deprecated: Use Host.ProtoReflect.Descriptor instead.

func (*Host) GetDownloadPort added in v1.4.1

func (x *Host) GetDownloadPort() int32

func (*Host) GetHostname added in v1.4.1

func (x *Host) GetHostname() string

func (*Host) GetId added in v1.4.1

func (x *Host) GetId() string

func (*Host) GetIdc added in v1.4.1

func (x *Host) GetIdc() string

func (*Host) GetIp added in v1.4.8

func (x *Host) GetIp() string

func (*Host) GetLocation added in v1.4.1

func (x *Host) GetLocation() string

func (*Host) GetPort added in v1.4.1

func (x *Host) GetPort() int32

func (*Host) GetSecurityDomain added in v1.4.1

func (x *Host) GetSecurityDomain() string

func (*Host) ProtoMessage added in v1.4.1

func (*Host) ProtoMessage()

func (*Host) ProtoReflect added in v1.4.1

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

func (*Host) Reset added in v1.4.1

func (x *Host) Reset()

func (*Host) String added in v1.4.1

func (x *Host) String() string

func (*Host) Validate added in v1.4.1

func (m *Host) Validate() error

Validate checks the field values on Host 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 (*Host) ValidateAll added in v1.4.1

func (m *Host) ValidateAll() error

ValidateAll checks the field values on Host 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 HostMultiError, or nil if none found.

type HostMultiError added in v1.4.1

type HostMultiError []error

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

func (HostMultiError) AllErrors added in v1.4.1

func (m HostMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (HostMultiError) Error added in v1.4.1

func (m HostMultiError) Error() string

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

type HostValidationError added in v1.4.1

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

HostValidationError is the validation error returned by Host.Validate if the designated constraints aren't met.

func (HostValidationError) Cause added in v1.4.1

func (e HostValidationError) Cause() error

Cause function returns cause value.

func (HostValidationError) Error added in v1.4.1

func (e HostValidationError) Error() string

Error satisfies the builtin error interface

func (HostValidationError) ErrorName added in v1.4.1

func (e HostValidationError) ErrorName() string

ErrorName returns error name.

func (HostValidationError) Field added in v1.4.1

func (e HostValidationError) Field() string

Field function returns field value.

func (HostValidationError) Key added in v1.4.1

func (e HostValidationError) Key() bool

Key function returns key value.

func (HostValidationError) Reason added in v1.4.1

func (e HostValidationError) Reason() string

Reason function returns reason value.

type Peer added in v1.4.1

type Peer struct {

	// Peer id.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Range is url range of request.
	Range *Range `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"`
	// Peer priority.
	Priority Priority `protobuf:"varint,3,opt,name=priority,proto3,enum=common.v2.Priority" json:"priority,omitempty"`
	// Pieces of peer.
	Pieces []*Piece `protobuf:"bytes,4,rep,name=pieces,proto3" json:"pieces,omitempty"`
	// Peer downloads costs time.
	Cost *durationpb.Duration `protobuf:"bytes,5,opt,name=cost,proto3" json:"cost,omitempty"`
	// Peer state.
	State string `protobuf:"bytes,6,opt,name=state,proto3" json:"state,omitempty"`
	// Task info.
	Task *Task `protobuf:"bytes,7,opt,name=task,proto3" json:"task,omitempty"`
	// Host info.
	Host *Host `protobuf:"bytes,8,opt,name=host,proto3" json:"host,omitempty"`
	// NeedBackToSource needs downloaded from source.
	NeedBackToSource bool `protobuf:"varint,9,opt,name=need_back_to_source,json=needBackToSource,proto3" json:"need_back_to_source,omitempty"`
	// Peer create time.
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// Peer update time.
	UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

Peer metadata.

func (*Peer) Descriptor deprecated added in v1.4.1

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

Deprecated: Use Peer.ProtoReflect.Descriptor instead.

func (*Peer) GetCost added in v1.5.0

func (x *Peer) GetCost() *durationpb.Duration

func (*Peer) GetCreatedAt added in v1.4.1

func (x *Peer) GetCreatedAt() *timestamppb.Timestamp

func (*Peer) GetHost added in v1.4.1

func (x *Peer) GetHost() *Host

func (*Peer) GetId added in v1.4.1

func (x *Peer) GetId() string

func (*Peer) GetNeedBackToSource added in v1.5.0

func (x *Peer) GetNeedBackToSource() bool

func (*Peer) GetPieces added in v1.4.1

func (x *Peer) GetPieces() []*Piece

func (*Peer) GetPriority added in v1.5.0

func (x *Peer) GetPriority() Priority

func (*Peer) GetRange added in v1.5.0

func (x *Peer) GetRange() *Range

func (*Peer) GetState added in v1.4.1

func (x *Peer) GetState() string

func (*Peer) GetTask added in v1.4.1

func (x *Peer) GetTask() *Task

func (*Peer) GetUpdatedAt added in v1.4.1

func (x *Peer) GetUpdatedAt() *timestamppb.Timestamp

func (*Peer) ProtoMessage added in v1.4.1

func (*Peer) ProtoMessage()

func (*Peer) ProtoReflect added in v1.4.1

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

func (*Peer) Reset added in v1.4.1

func (x *Peer) Reset()

func (*Peer) String added in v1.4.1

func (x *Peer) String() string

func (*Peer) Validate added in v1.4.1

func (m *Peer) Validate() error

Validate checks the field values on Peer 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 (*Peer) ValidateAll added in v1.4.1

func (m *Peer) ValidateAll() error

ValidateAll checks the field values on Peer 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 PeerMultiError, or nil if none found.

type PeerMultiError added in v1.4.1

type PeerMultiError []error

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

func (PeerMultiError) AllErrors added in v1.4.1

func (m PeerMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PeerMultiError) Error added in v1.4.1

func (m PeerMultiError) Error() string

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

type PeerValidationError added in v1.4.1

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

PeerValidationError is the validation error returned by Peer.Validate if the designated constraints aren't met.

func (PeerValidationError) Cause added in v1.4.1

func (e PeerValidationError) Cause() error

Cause function returns cause value.

func (PeerValidationError) Error added in v1.4.1

func (e PeerValidationError) Error() string

Error satisfies the builtin error interface

func (PeerValidationError) ErrorName added in v1.4.1

func (e PeerValidationError) ErrorName() string

ErrorName returns error name.

func (PeerValidationError) Field added in v1.4.1

func (e PeerValidationError) Field() string

Field function returns field value.

func (PeerValidationError) Key added in v1.4.1

func (e PeerValidationError) Key() bool

Key function returns key value.

func (PeerValidationError) Reason added in v1.4.1

func (e PeerValidationError) Reason() string

Reason function returns reason value.

type Piece

type Piece struct {

	// Piece number.
	Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
	// Parent peer id.
	ParentId string `protobuf:"bytes,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`
	// Piece offset.
	Offset uint64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
	// Piece length.
	Length uint64 `protobuf:"varint,4,opt,name=length,proto3" json:"length,omitempty"`
	// Digest of the piece data, for example md5:xxx or sha256:yyy.
	Digest string `protobuf:"bytes,5,opt,name=digest,proto3" json:"digest,omitempty"`
	// Traffic type.
	TrafficType TrafficType `protobuf:"varint,6,opt,name=traffic_type,json=trafficType,proto3,enum=common.v2.TrafficType" json:"traffic_type,omitempty"`
	// Downloading piece costs time.
	Cost *durationpb.Duration `protobuf:"bytes,7,opt,name=cost,proto3" json:"cost,omitempty"`
	// Piece create time.
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// contains filtered or unexported fields
}

Piece represents information of piece.

func (*Piece) Descriptor deprecated

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

Deprecated: Use Piece.ProtoReflect.Descriptor instead.

func (*Piece) GetCost

func (x *Piece) GetCost() *durationpb.Duration

func (*Piece) GetCreatedAt

func (x *Piece) GetCreatedAt() *timestamppb.Timestamp

func (*Piece) GetDigest

func (x *Piece) GetDigest() string

func (*Piece) GetLength added in v1.5.2

func (x *Piece) GetLength() uint64

func (*Piece) GetNumber

func (x *Piece) GetNumber() int32

func (*Piece) GetOffset

func (x *Piece) GetOffset() uint64

func (*Piece) GetParentId

func (x *Piece) GetParentId() string

func (*Piece) GetTrafficType added in v1.2.3

func (x *Piece) GetTrafficType() TrafficType

func (*Piece) ProtoMessage

func (*Piece) ProtoMessage()

func (*Piece) ProtoReflect

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

func (*Piece) Reset

func (x *Piece) Reset()

func (*Piece) String

func (x *Piece) String() string

func (*Piece) Validate

func (m *Piece) Validate() error

Validate checks the field values on Piece 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 (*Piece) ValidateAll

func (m *Piece) ValidateAll() error

ValidateAll checks the field values on Piece 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 PieceMultiError, or nil if none found.

type PieceMultiError

type PieceMultiError []error

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

func (PieceMultiError) AllErrors

func (m PieceMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PieceMultiError) Error

func (m PieceMultiError) Error() string

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

type PieceValidationError

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

PieceValidationError is the validation error returned by Piece.Validate if the designated constraints aren't met.

func (PieceValidationError) Cause

func (e PieceValidationError) Cause() error

Cause function returns cause value.

func (PieceValidationError) Error

func (e PieceValidationError) Error() string

Error satisfies the builtin error interface

func (PieceValidationError) ErrorName

func (e PieceValidationError) ErrorName() string

ErrorName returns error name.

func (PieceValidationError) Field

func (e PieceValidationError) Field() string

Field function returns field value.

func (PieceValidationError) Key

func (e PieceValidationError) Key() bool

Key function returns key value.

func (PieceValidationError) Reason

func (e PieceValidationError) Reason() string

Reason function returns reason value.

type Priority added in v1.3.7

type Priority int32

Priority represents priority of application.

const (
	// LEVEL0 has no special meaning for scheduler.
	Priority_LEVEL0 Priority = 0
	// LEVEL1 represents the download task is forbidden,
	// and an error code is returned during the registration.
	Priority_LEVEL1 Priority = 1
	// LEVEL2 represents when the task is downloaded for the first time,
	// allow peers to download from the other peers,
	// but not back-to-source. When the task is not downloaded for
	// the first time, it is scheduled normally.
	Priority_LEVEL2 Priority = 2
	// LEVEL3 represents when the task is downloaded for the first time,
	// the normal peer is first to download back-to-source.
	// When the task is not downloaded for the first time, it is scheduled normally.
	Priority_LEVEL3 Priority = 3
	// LEVEL4 represents when the task is downloaded for the first time,
	// the weak peer is first triggered to back-to-source.
	// When the task is not downloaded for the first time, it is scheduled normally.
	Priority_LEVEL4 Priority = 4
	// LEVEL5 represents when the task is downloaded for the first time,
	// the strong peer is first triggered to back-to-source.
	// When the task is not downloaded for the first time, it is scheduled normally.
	Priority_LEVEL5 Priority = 5
	// LEVEL6 represents when the task is downloaded for the first time,
	// the super peer is first triggered to back-to-source.
	// When the task is not downloaded for the first time, it is scheduled normally.
	Priority_LEVEL6 Priority = 6
)

func (Priority) Descriptor added in v1.3.7

func (Priority) Descriptor() protoreflect.EnumDescriptor

func (Priority) Enum added in v1.3.7

func (x Priority) Enum() *Priority

func (Priority) EnumDescriptor deprecated added in v1.3.7

func (Priority) EnumDescriptor() ([]byte, []int)

Deprecated: Use Priority.Descriptor instead.

func (Priority) Number added in v1.3.7

func (x Priority) Number() protoreflect.EnumNumber

func (Priority) String added in v1.3.7

func (x Priority) String() string

func (Priority) Type added in v1.3.7

type Range

type Range struct {

	// Start of range.
	Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"`
	// Length of range.
	Length int64 `protobuf:"varint,2,opt,name=length,proto3" json:"length,omitempty"`
	// contains filtered or unexported fields
}

Range represents download range.

func (*Range) Descriptor deprecated

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

Deprecated: Use Range.ProtoReflect.Descriptor instead.

func (*Range) GetLength added in v1.5.1

func (x *Range) GetLength() int64

func (*Range) GetStart added in v1.5.1

func (x *Range) GetStart() int64

func (*Range) ProtoMessage

func (*Range) ProtoMessage()

func (*Range) ProtoReflect

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

func (*Range) Reset

func (x *Range) Reset()

func (*Range) String

func (x *Range) String() string

func (*Range) Validate

func (m *Range) Validate() error

Validate checks the field values on Range 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 (*Range) ValidateAll

func (m *Range) ValidateAll() error

ValidateAll checks the field values on Range 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 RangeMultiError, or nil if none found.

type RangeMultiError

type RangeMultiError []error

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

func (RangeMultiError) AllErrors

func (m RangeMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RangeMultiError) Error

func (m RangeMultiError) Error() string

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

type RangeValidationError

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

RangeValidationError is the validation error returned by Range.Validate if the designated constraints aren't met.

func (RangeValidationError) Cause

func (e RangeValidationError) Cause() error

Cause function returns cause value.

func (RangeValidationError) Error

func (e RangeValidationError) Error() string

Error satisfies the builtin error interface

func (RangeValidationError) ErrorName

func (e RangeValidationError) ErrorName() string

ErrorName returns error name.

func (RangeValidationError) Field

func (e RangeValidationError) Field() string

Field function returns field value.

func (RangeValidationError) Key

func (e RangeValidationError) Key() bool

Key function returns key value.

func (RangeValidationError) Reason

func (e RangeValidationError) Reason() string

Reason function returns reason value.

type SizeScope

type SizeScope int32

SizeScope represents size scope of task.

const (
	// NORMAL task has pieces is more than one piece.
	SizeScope_NORMAL SizeScope = 0
	// SMALL task's content length is more than 128 byte and has only one piece.
	SizeScope_SMALL SizeScope = 1
	// TINY task's content length is less than 128 byte.
	SizeScope_TINY SizeScope = 2
	// EMPTY task's content length is equal to zero.
	SizeScope_EMPTY SizeScope = 3
	// UNKNOW task has invalid size scope.
	SizeScope_UNKNOW SizeScope = 4
)

func (SizeScope) Descriptor

func (SizeScope) Descriptor() protoreflect.EnumDescriptor

func (SizeScope) Enum

func (x SizeScope) Enum() *SizeScope

func (SizeScope) EnumDescriptor deprecated

func (SizeScope) EnumDescriptor() ([]byte, []int)

Deprecated: Use SizeScope.Descriptor instead.

func (SizeScope) Number

func (x SizeScope) Number() protoreflect.EnumNumber

func (SizeScope) String

func (x SizeScope) String() string

func (SizeScope) Type

type Task added in v1.4.1

type Task struct {

	// Task id.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Task type.
	Type TaskType `protobuf:"varint,2,opt,name=type,proto3,enum=common.v2.TaskType" json:"type,omitempty"`
	// Download url.
	Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
	// Digest of the pieces digest, for example md5:xxx or sha256:yyy.
	Digest string `protobuf:"bytes,4,opt,name=digest,proto3" json:"digest,omitempty"`
	// URL tag identifies different task for same url.
	Tag string `protobuf:"bytes,5,opt,name=tag,proto3" json:"tag,omitempty"`
	// Application of task.
	Application string `protobuf:"bytes,6,opt,name=application,proto3" json:"application,omitempty"`
	// Filter url used to generate task id.
	Filters []string `protobuf:"bytes,7,rep,name=filters,proto3" json:"filters,omitempty"`
	// Task request headers.
	Header map[string]string `` /* 153-byte string literal not displayed */
	// Task piece length.
	PieceLength int32 `protobuf:"varint,9,opt,name=piece_length,json=pieceLength,proto3" json:"piece_length,omitempty"`
	// Task content length.
	ContentLength int64 `protobuf:"varint,10,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"`
	// Task piece count.
	PieceCount int64 `protobuf:"varint,11,opt,name=piece_count,json=pieceCount,proto3" json:"piece_count,omitempty"`
	// Task size scope.
	SizeScope SizeScope `protobuf:"varint,12,opt,name=size_scope,json=sizeScope,proto3,enum=common.v2.SizeScope" json:"size_scope,omitempty"`
	// Pieces of task.
	Pieces []*Piece `protobuf:"bytes,13,rep,name=pieces,proto3" json:"pieces,omitempty"`
	// Task state.
	State string `protobuf:"bytes,14,opt,name=state,proto3" json:"state,omitempty"`
	// Task peer count.
	PeerCount int32 `protobuf:"varint,15,opt,name=peer_count,json=peerCount,proto3" json:"peer_count,omitempty"`
	// Task contains available peer.
	HasAvailablePeer bool `protobuf:"varint,16,opt,name=hasAvailablePeer,proto3" json:"hasAvailablePeer,omitempty"`
	// Task create time.
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,17,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// Task update time.
	UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,18,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

Task metadata.

func (*Task) Descriptor deprecated added in v1.4.1

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

Deprecated: Use Task.ProtoReflect.Descriptor instead.

func (*Task) GetApplication added in v1.5.0

func (x *Task) GetApplication() string

func (*Task) GetContentLength added in v1.4.1

func (x *Task) GetContentLength() int64

func (*Task) GetCreatedAt added in v1.4.1

func (x *Task) GetCreatedAt() *timestamppb.Timestamp

func (*Task) GetDigest added in v1.5.0

func (x *Task) GetDigest() string

func (*Task) GetFilters added in v1.5.0

func (x *Task) GetFilters() []string

func (*Task) GetHasAvailablePeer added in v1.4.1

func (x *Task) GetHasAvailablePeer() bool

func (*Task) GetHeader added in v1.5.0

func (x *Task) GetHeader() map[string]string

func (*Task) GetId added in v1.4.1

func (x *Task) GetId() string

func (*Task) GetPeerCount added in v1.4.1

func (x *Task) GetPeerCount() int32

func (*Task) GetPieceCount added in v1.5.0

func (x *Task) GetPieceCount() int64

func (*Task) GetPieceLength added in v1.5.2

func (x *Task) GetPieceLength() int32

func (*Task) GetPieces added in v1.4.1

func (x *Task) GetPieces() []*Piece

func (*Task) GetSizeScope added in v1.4.1

func (x *Task) GetSizeScope() SizeScope

func (*Task) GetState added in v1.4.1

func (x *Task) GetState() string

func (*Task) GetTag added in v1.5.0

func (x *Task) GetTag() string

func (*Task) GetType added in v1.4.1

func (x *Task) GetType() TaskType

func (*Task) GetUpdatedAt added in v1.4.1

func (x *Task) GetUpdatedAt() *timestamppb.Timestamp

func (*Task) GetUrl added in v1.5.0

func (x *Task) GetUrl() string

func (*Task) ProtoMessage added in v1.4.1

func (*Task) ProtoMessage()

func (*Task) ProtoReflect added in v1.4.1

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

func (*Task) Reset added in v1.4.1

func (x *Task) Reset()

func (*Task) String added in v1.4.1

func (x *Task) String() string

func (*Task) Validate added in v1.4.1

func (m *Task) Validate() error

Validate checks the field values on Task 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 (*Task) ValidateAll added in v1.4.1

func (m *Task) ValidateAll() error

ValidateAll checks the field values on Task 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 TaskMultiError, or nil if none found.

type TaskMultiError added in v1.4.1

type TaskMultiError []error

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

func (TaskMultiError) AllErrors added in v1.4.1

func (m TaskMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (TaskMultiError) Error added in v1.4.1

func (m TaskMultiError) Error() string

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

type TaskType

type TaskType int32

TaskType represents type of task.

const (
	// DFDAEMON is dfdeamon type of task,
	// dfdeamon task is a normal p2p task.
	TaskType_DFDAEMON TaskType = 0
	// DFCACHE is dfcache type of task,
	// dfcache task is a cache task, and the task url is fake url.
	// It can only be used for caching and cannot be downloaded back to source.
	TaskType_DFCACHE TaskType = 1
	// DFSTORE is dfstore type of task,
	// dfstore task is a persistent task in backend.
	TaskType_DFSTORE TaskType = 2
)

func (TaskType) Descriptor

func (TaskType) Descriptor() protoreflect.EnumDescriptor

func (TaskType) Enum

func (x TaskType) Enum() *TaskType

func (TaskType) EnumDescriptor deprecated

func (TaskType) EnumDescriptor() ([]byte, []int)

Deprecated: Use TaskType.Descriptor instead.

func (TaskType) Number

func (x TaskType) Number() protoreflect.EnumNumber

func (TaskType) String

func (x TaskType) String() string

func (TaskType) Type

type TaskValidationError added in v1.4.1

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

TaskValidationError is the validation error returned by Task.Validate if the designated constraints aren't met.

func (TaskValidationError) Cause added in v1.4.1

func (e TaskValidationError) Cause() error

Cause function returns cause value.

func (TaskValidationError) Error added in v1.4.1

func (e TaskValidationError) Error() string

Error satisfies the builtin error interface

func (TaskValidationError) ErrorName added in v1.4.1

func (e TaskValidationError) ErrorName() string

ErrorName returns error name.

func (TaskValidationError) Field added in v1.4.1

func (e TaskValidationError) Field() string

Field function returns field value.

func (TaskValidationError) Key added in v1.4.1

func (e TaskValidationError) Key() bool

Key function returns key value.

func (TaskValidationError) Reason added in v1.4.1

func (e TaskValidationError) Reason() string

Reason function returns reason value.

type TrafficType added in v1.2.3

type TrafficType int32

TrafficType represents type of traffic.

const (
	// BACK_TO_SOURCE is to download traffic from the source.
	TrafficType_BACK_TO_SOURCE TrafficType = 0
	// REMOTE_PEER is to download traffic from the remote peer.
	TrafficType_REMOTE_PEER TrafficType = 1
	// LOCAL_PEER is to download traffic from the local peer.
	TrafficType_LOCAL_PEER TrafficType = 2
)

func (TrafficType) Descriptor added in v1.2.3

func (TrafficType) Enum added in v1.2.3

func (x TrafficType) Enum() *TrafficType

func (TrafficType) EnumDescriptor deprecated added in v1.2.3

func (TrafficType) EnumDescriptor() ([]byte, []int)

Deprecated: Use TrafficType.Descriptor instead.

func (TrafficType) Number added in v1.2.3

func (x TrafficType) Number() protoreflect.EnumNumber

func (TrafficType) String added in v1.2.3

func (x TrafficType) String() string

func (TrafficType) Type added in v1.2.3

Jump to

Keyboard shortcuts

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