cdnsystem

package
v2.0.116 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 22 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_pkg_apis_cdnsystem_v1_cdnsystem_proto protoreflect.FileDescriptor
View Source
var Seeder_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "cdnsystem.Seeder",
	HandlerType: (*SeederServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetPieceTasks",
			Handler:    _Seeder_GetPieceTasks_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ObtainSeeds",
			Handler:       _Seeder_ObtainSeeds_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "SyncPieceTasks",
			Handler:       _Seeder_SyncPieceTasks_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "pkg/apis/cdnsystem/v1/cdnsystem.proto",
}

Seeder_ServiceDesc is the grpc.ServiceDesc for Seeder service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterSeederServer

func RegisterSeederServer(s grpc.ServiceRegistrar, srv SeederServer)

Types

type PieceSeed

type PieceSeed struct {

	// reuse already downloaded peer
	Reuse bool `protobuf:"varint,1,opt,name=reuse,proto3" json:"reuse,omitempty"`
	// peer id for cdn node, need suffix with _CDN
	PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	// cdn host id
	HostId string `protobuf:"bytes,3,opt,name=host_id,json=hostId,proto3" json:"host_id,omitempty"`
	// piece info
	PieceInfo *v1.PieceInfo `protobuf:"bytes,4,opt,name=piece_info,json=pieceInfo,proto3" json:"piece_info,omitempty"`
	// whether or not all seeds are downloaded
	Done bool `protobuf:"varint,5,opt,name=done,proto3" json:"done,omitempty"`
	// content total length for the url, content_length < 0 represent content length is unknown
	ContentLength int64 `protobuf:"varint,6,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"`
	// total piece count, -1 represents task is downloading or failed
	TotalPieceCount int32 `protobuf:"varint,7,opt,name=total_piece_count,json=totalPieceCount,proto3" json:"total_piece_count,omitempty"`
	// begin time for the piece downloading
	BeginTime uint64 `protobuf:"varint,8,opt,name=begin_time,json=beginTime,proto3" json:"begin_time,omitempty"`
	// end time for the piece downloading
	EndTime uint64 `protobuf:"varint,9,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
	// task extend attribute
	ExtendAttribute *v1.ExtendAttribute `protobuf:"bytes,10,opt,name=extend_attribute,json=extendAttribute,proto3" json:"extend_attribute,omitempty"`
	// contains filtered or unexported fields
}

keep piece meta and data separately check piece md5, md5s sign and total content length

func (*PieceSeed) Descriptor deprecated

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

Deprecated: Use PieceSeed.ProtoReflect.Descriptor instead.

func (*PieceSeed) GetBeginTime

func (x *PieceSeed) GetBeginTime() uint64

func (*PieceSeed) GetContentLength

func (x *PieceSeed) GetContentLength() int64

func (*PieceSeed) GetDone

func (x *PieceSeed) GetDone() bool

func (*PieceSeed) GetEndTime

func (x *PieceSeed) GetEndTime() uint64

func (*PieceSeed) GetExtendAttribute

func (x *PieceSeed) GetExtendAttribute() *v1.ExtendAttribute

func (*PieceSeed) GetHostId

func (x *PieceSeed) GetHostId() string

func (*PieceSeed) GetPeerId

func (x *PieceSeed) GetPeerId() string

func (*PieceSeed) GetPieceInfo

func (x *PieceSeed) GetPieceInfo() *v1.PieceInfo

func (*PieceSeed) GetReuse

func (x *PieceSeed) GetReuse() bool

func (*PieceSeed) GetTotalPieceCount

func (x *PieceSeed) GetTotalPieceCount() int32

func (*PieceSeed) ProtoMessage

func (*PieceSeed) ProtoMessage()

func (*PieceSeed) ProtoReflect

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

func (*PieceSeed) Reset

func (x *PieceSeed) Reset()

func (*PieceSeed) String

func (x *PieceSeed) String() string

func (*PieceSeed) Validate

func (m *PieceSeed) Validate() error

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

func (m *PieceSeed) ValidateAll() error

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

type PieceSeedMultiError

type PieceSeedMultiError []error

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

func (PieceSeedMultiError) AllErrors

func (m PieceSeedMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PieceSeedMultiError) Error

func (m PieceSeedMultiError) Error() string

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

type PieceSeedValidationError

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

PieceSeedValidationError is the validation error returned by PieceSeed.Validate if the designated constraints aren't met.

func (PieceSeedValidationError) Cause

func (e PieceSeedValidationError) Cause() error

Cause function returns cause value.

func (PieceSeedValidationError) Error

func (e PieceSeedValidationError) Error() string

Error satisfies the builtin error interface

func (PieceSeedValidationError) ErrorName

func (e PieceSeedValidationError) ErrorName() string

ErrorName returns error name.

func (PieceSeedValidationError) Field

func (e PieceSeedValidationError) Field() string

Field function returns field value.

func (PieceSeedValidationError) Key

Key function returns key value.

func (PieceSeedValidationError) Reason

func (e PieceSeedValidationError) Reason() string

Reason function returns reason value.

type SeedRequest

type SeedRequest struct {
	TaskId  string      `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
	Url     string      `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
	UrlMeta *v1.UrlMeta `protobuf:"bytes,3,opt,name=url_meta,json=urlMeta,proto3" json:"url_meta,omitempty"`
	// contains filtered or unexported fields
}

func (*SeedRequest) Descriptor deprecated

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

Deprecated: Use SeedRequest.ProtoReflect.Descriptor instead.

func (*SeedRequest) GetTaskId

func (x *SeedRequest) GetTaskId() string

func (*SeedRequest) GetUrl

func (x *SeedRequest) GetUrl() string

func (*SeedRequest) GetUrlMeta

func (x *SeedRequest) GetUrlMeta() *v1.UrlMeta

func (*SeedRequest) ProtoMessage

func (*SeedRequest) ProtoMessage()

func (*SeedRequest) ProtoReflect

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

func (*SeedRequest) Reset

func (x *SeedRequest) Reset()

func (*SeedRequest) String

func (x *SeedRequest) String() string

func (*SeedRequest) Validate

func (m *SeedRequest) Validate() error

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

func (m *SeedRequest) ValidateAll() error

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

type SeedRequestMultiError

type SeedRequestMultiError []error

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

func (SeedRequestMultiError) AllErrors

func (m SeedRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SeedRequestMultiError) Error

func (m SeedRequestMultiError) Error() string

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

type SeedRequestValidationError

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

SeedRequestValidationError is the validation error returned by SeedRequest.Validate if the designated constraints aren't met.

func (SeedRequestValidationError) Cause

Cause function returns cause value.

func (SeedRequestValidationError) Error

Error satisfies the builtin error interface

func (SeedRequestValidationError) ErrorName

func (e SeedRequestValidationError) ErrorName() string

ErrorName returns error name.

func (SeedRequestValidationError) Field

Field function returns field value.

func (SeedRequestValidationError) Key

Key function returns key value.

func (SeedRequestValidationError) Reason

Reason function returns reason value.

type SeederClient

type SeederClient interface {
	// Generate seeds and return to scheduler
	ObtainSeeds(ctx context.Context, in *SeedRequest, opts ...grpc.CallOption) (Seeder_ObtainSeedsClient, error)
	// Get piece tasks from cdn
	GetPieceTasks(ctx context.Context, in *v1.PieceTaskRequest, opts ...grpc.CallOption) (*v1.PiecePacket, error)
	// Sync piece tasks with other peers
	SyncPieceTasks(ctx context.Context, opts ...grpc.CallOption) (Seeder_SyncPieceTasksClient, error)
}

SeederClient is the client API for Seeder 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 NewSeederClient

func NewSeederClient(cc grpc.ClientConnInterface) SeederClient

type SeederServer

type SeederServer interface {
	// Generate seeds and return to scheduler
	ObtainSeeds(*SeedRequest, Seeder_ObtainSeedsServer) error
	// Get piece tasks from cdn
	GetPieceTasks(context.Context, *v1.PieceTaskRequest) (*v1.PiecePacket, error)
	// Sync piece tasks with other peers
	SyncPieceTasks(Seeder_SyncPieceTasksServer) error
}

SeederServer is the server API for Seeder service. All implementations should embed UnimplementedSeederServer for forward compatibility

type Seeder_ObtainSeedsClient

type Seeder_ObtainSeedsClient interface {
	Recv() (*PieceSeed, error)
	grpc.ClientStream
}

type Seeder_ObtainSeedsServer

type Seeder_ObtainSeedsServer interface {
	Send(*PieceSeed) error
	grpc.ServerStream
}

type Seeder_SyncPieceTasksClient

type Seeder_SyncPieceTasksClient interface {
	Send(*v1.PieceTaskRequest) error
	Recv() (*v1.PiecePacket, error)
	grpc.ClientStream
}

type Seeder_SyncPieceTasksServer

type Seeder_SyncPieceTasksServer interface {
	Send(*v1.PiecePacket) error
	Recv() (*v1.PieceTaskRequest, error)
	grpc.ServerStream
}

type UnimplementedSeederServer

type UnimplementedSeederServer struct {
}

UnimplementedSeederServer should be embedded to have forward compatible implementations.

func (UnimplementedSeederServer) GetPieceTasks

func (UnimplementedSeederServer) ObtainSeeds

func (UnimplementedSeederServer) SyncPieceTasks

type UnsafeSeederServer

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

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

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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