api/pkg/apis/cdnsystem/v1/cdnsystem.pb.go

593 lines
21 KiB
Go

//
// Copyright 2022 The Dragonfly Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: pkg/apis/cdnsystem/v1/cdnsystem.proto
package v1
import (
context "context"
v1 "d7y.io/api/pkg/apis/common/v1"
_ "github.com/envoyproxy/protoc-gen-validate/validate"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type SeedRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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"`
}
func (x *SeedRequest) Reset() {
*x = SeedRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SeedRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SeedRequest) ProtoMessage() {}
func (x *SeedRequest) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SeedRequest.ProtoReflect.Descriptor instead.
func (*SeedRequest) Descriptor() ([]byte, []int) {
return file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescGZIP(), []int{0}
}
func (x *SeedRequest) GetTaskId() string {
if x != nil {
return x.TaskId
}
return ""
}
func (x *SeedRequest) GetUrl() string {
if x != nil {
return x.Url
}
return ""
}
func (x *SeedRequest) GetUrlMeta() *v1.UrlMeta {
if x != nil {
return x.UrlMeta
}
return nil
}
// keep piece meta and data separately
// check piece md5, md5s sign and total content length
type PieceSeed struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// 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"`
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"`
}
func (x *PieceSeed) Reset() {
*x = PieceSeed{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PieceSeed) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PieceSeed) ProtoMessage() {}
func (x *PieceSeed) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PieceSeed.ProtoReflect.Descriptor instead.
func (*PieceSeed) Descriptor() ([]byte, []int) {
return file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescGZIP(), []int{1}
}
func (x *PieceSeed) GetPeerId() string {
if x != nil {
return x.PeerId
}
return ""
}
func (x *PieceSeed) GetHostId() string {
if x != nil {
return x.HostId
}
return ""
}
func (x *PieceSeed) GetPieceInfo() *v1.PieceInfo {
if x != nil {
return x.PieceInfo
}
return nil
}
func (x *PieceSeed) GetDone() bool {
if x != nil {
return x.Done
}
return false
}
func (x *PieceSeed) GetContentLength() int64 {
if x != nil {
return x.ContentLength
}
return 0
}
func (x *PieceSeed) GetTotalPieceCount() int32 {
if x != nil {
return x.TotalPieceCount
}
return 0
}
func (x *PieceSeed) GetBeginTime() uint64 {
if x != nil {
return x.BeginTime
}
return 0
}
func (x *PieceSeed) GetEndTime() uint64 {
if x != nil {
return x.EndTime
}
return 0
}
func (x *PieceSeed) GetExtendAttribute() *v1.ExtendAttribute {
if x != nil {
return x.ExtendAttribute
}
return nil
}
var File_pkg_apis_cdnsystem_v1_cdnsystem_proto protoreflect.FileDescriptor
var file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDesc = []byte{
0x0a, 0x25, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x63, 0x64, 0x6e, 0x73, 0x79,
0x73, 0x74, 0x65, 0x6d, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x64, 0x6e, 0x73, 0x79, 0x73, 0x74, 0x65,
0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x64, 0x6e, 0x73, 0x79, 0x73, 0x74,
0x65, 0x6d, 0x1a, 0x1f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x77, 0x0a, 0x0b,
0x53, 0x65, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74,
0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42,
0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a,
0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x72,
0x03, 0x88, 0x01, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x2a, 0x0a, 0x08, 0x75, 0x72, 0x6c,
0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x55, 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x07, 0x75, 0x72,
0x6c, 0x4d, 0x65, 0x74, 0x61, 0x22, 0xe6, 0x02, 0x0a, 0x09, 0x50, 0x69, 0x65, 0x63, 0x65, 0x53,
0x65, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x70,
0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52,
0x06, 0x68, 0x6f, 0x73, 0x74, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0a, 0x70, 0x69, 0x65, 0x63, 0x65,
0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09,
0x70, 0x69, 0x65, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x6f, 0x6e,
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x64, 0x6f, 0x6e, 0x65, 0x12, 0x25, 0x0a,
0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18,
0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, 0x65,
0x6e, 0x67, 0x74, 0x68, 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x69,
0x65, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52,
0x0f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x69, 0x65, 0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08,
0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12,
0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28,
0x04, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x10, 0x65, 0x78,
0x74, 0x65, 0x6e, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x0a,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x78,
0x74, 0x65, 0x6e, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0f, 0x65,
0x78, 0x74, 0x65, 0x6e, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x32, 0xcc,
0x01, 0x0a, 0x06, 0x53, 0x65, 0x65, 0x64, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x0b, 0x4f, 0x62, 0x74,
0x61, 0x69, 0x6e, 0x53, 0x65, 0x65, 0x64, 0x73, 0x12, 0x16, 0x2e, 0x63, 0x64, 0x6e, 0x73, 0x79,
0x73, 0x74, 0x65, 0x6d, 0x2e, 0x53, 0x65, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x14, 0x2e, 0x63, 0x64, 0x6e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x50, 0x69, 0x65,
0x63, 0x65, 0x53, 0x65, 0x65, 0x64, 0x30, 0x01, 0x12, 0x3e, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50,
0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x12, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65,
0x63, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x43, 0x0a, 0x0e, 0x53, 0x79, 0x6e, 0x63,
0x50, 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x12, 0x18, 0x2e, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69,
0x65, 0x63, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x28, 0x01, 0x30, 0x01, 0x42, 0x22, 0x5a,
0x20, 0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6b, 0x67, 0x2f,
0x61, 0x70, 0x69, 0x73, 0x2f, 0x63, 0x64, 0x6e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x76,
0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescOnce sync.Once
file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescData = file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDesc
)
func file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescGZIP() []byte {
file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescOnce.Do(func() {
file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescData)
})
return file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescData
}
var file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_pkg_apis_cdnsystem_v1_cdnsystem_proto_goTypes = []interface{}{
(*SeedRequest)(nil), // 0: cdnsystem.SeedRequest
(*PieceSeed)(nil), // 1: cdnsystem.PieceSeed
(*v1.UrlMeta)(nil), // 2: common.UrlMeta
(*v1.PieceInfo)(nil), // 3: common.PieceInfo
(*v1.ExtendAttribute)(nil), // 4: common.ExtendAttribute
(*v1.PieceTaskRequest)(nil), // 5: common.PieceTaskRequest
(*v1.PiecePacket)(nil), // 6: common.PiecePacket
}
var file_pkg_apis_cdnsystem_v1_cdnsystem_proto_depIdxs = []int32{
2, // 0: cdnsystem.SeedRequest.url_meta:type_name -> common.UrlMeta
3, // 1: cdnsystem.PieceSeed.piece_info:type_name -> common.PieceInfo
4, // 2: cdnsystem.PieceSeed.extend_attribute:type_name -> common.ExtendAttribute
0, // 3: cdnsystem.Seeder.ObtainSeeds:input_type -> cdnsystem.SeedRequest
5, // 4: cdnsystem.Seeder.GetPieceTasks:input_type -> common.PieceTaskRequest
5, // 5: cdnsystem.Seeder.SyncPieceTasks:input_type -> common.PieceTaskRequest
1, // 6: cdnsystem.Seeder.ObtainSeeds:output_type -> cdnsystem.PieceSeed
6, // 7: cdnsystem.Seeder.GetPieceTasks:output_type -> common.PiecePacket
6, // 8: cdnsystem.Seeder.SyncPieceTasks:output_type -> common.PiecePacket
6, // [6:9] is the sub-list for method output_type
3, // [3:6] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_pkg_apis_cdnsystem_v1_cdnsystem_proto_init() }
func file_pkg_apis_cdnsystem_v1_cdnsystem_proto_init() {
if File_pkg_apis_cdnsystem_v1_cdnsystem_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SeedRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PieceSeed); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_pkg_apis_cdnsystem_v1_cdnsystem_proto_goTypes,
DependencyIndexes: file_pkg_apis_cdnsystem_v1_cdnsystem_proto_depIdxs,
MessageInfos: file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes,
}.Build()
File_pkg_apis_cdnsystem_v1_cdnsystem_proto = out.File
file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDesc = nil
file_pkg_apis_cdnsystem_v1_cdnsystem_proto_goTypes = nil
file_pkg_apis_cdnsystem_v1_cdnsystem_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// SeederClient is the client API for Seeder service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
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)
}
type seederClient struct {
cc grpc.ClientConnInterface
}
func NewSeederClient(cc grpc.ClientConnInterface) SeederClient {
return &seederClient{cc}
}
func (c *seederClient) ObtainSeeds(ctx context.Context, in *SeedRequest, opts ...grpc.CallOption) (Seeder_ObtainSeedsClient, error) {
stream, err := c.cc.NewStream(ctx, &_Seeder_serviceDesc.Streams[0], "/cdnsystem.Seeder/ObtainSeeds", opts...)
if err != nil {
return nil, err
}
x := &seederObtainSeedsClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Seeder_ObtainSeedsClient interface {
Recv() (*PieceSeed, error)
grpc.ClientStream
}
type seederObtainSeedsClient struct {
grpc.ClientStream
}
func (x *seederObtainSeedsClient) Recv() (*PieceSeed, error) {
m := new(PieceSeed)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *seederClient) GetPieceTasks(ctx context.Context, in *v1.PieceTaskRequest, opts ...grpc.CallOption) (*v1.PiecePacket, error) {
out := new(v1.PiecePacket)
err := c.cc.Invoke(ctx, "/cdnsystem.Seeder/GetPieceTasks", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *seederClient) SyncPieceTasks(ctx context.Context, opts ...grpc.CallOption) (Seeder_SyncPieceTasksClient, error) {
stream, err := c.cc.NewStream(ctx, &_Seeder_serviceDesc.Streams[1], "/cdnsystem.Seeder/SyncPieceTasks", opts...)
if err != nil {
return nil, err
}
x := &seederSyncPieceTasksClient{stream}
return x, nil
}
type Seeder_SyncPieceTasksClient interface {
Send(*v1.PieceTaskRequest) error
Recv() (*v1.PiecePacket, error)
grpc.ClientStream
}
type seederSyncPieceTasksClient struct {
grpc.ClientStream
}
func (x *seederSyncPieceTasksClient) Send(m *v1.PieceTaskRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *seederSyncPieceTasksClient) Recv() (*v1.PiecePacket, error) {
m := new(v1.PiecePacket)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// SeederServer is the server API for Seeder service.
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
}
// UnimplementedSeederServer can be embedded to have forward compatible implementations.
type UnimplementedSeederServer struct {
}
func (*UnimplementedSeederServer) ObtainSeeds(*SeedRequest, Seeder_ObtainSeedsServer) error {
return status.Errorf(codes.Unimplemented, "method ObtainSeeds not implemented")
}
func (*UnimplementedSeederServer) GetPieceTasks(context.Context, *v1.PieceTaskRequest) (*v1.PiecePacket, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPieceTasks not implemented")
}
func (*UnimplementedSeederServer) SyncPieceTasks(Seeder_SyncPieceTasksServer) error {
return status.Errorf(codes.Unimplemented, "method SyncPieceTasks not implemented")
}
func RegisterSeederServer(s *grpc.Server, srv SeederServer) {
s.RegisterService(&_Seeder_serviceDesc, srv)
}
func _Seeder_ObtainSeeds_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(SeedRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(SeederServer).ObtainSeeds(m, &seederObtainSeedsServer{stream})
}
type Seeder_ObtainSeedsServer interface {
Send(*PieceSeed) error
grpc.ServerStream
}
type seederObtainSeedsServer struct {
grpc.ServerStream
}
func (x *seederObtainSeedsServer) Send(m *PieceSeed) error {
return x.ServerStream.SendMsg(m)
}
func _Seeder_GetPieceTasks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v1.PieceTaskRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SeederServer).GetPieceTasks(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cdnsystem.Seeder/GetPieceTasks",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SeederServer).GetPieceTasks(ctx, req.(*v1.PieceTaskRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Seeder_SyncPieceTasks_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(SeederServer).SyncPieceTasks(&seederSyncPieceTasksServer{stream})
}
type Seeder_SyncPieceTasksServer interface {
Send(*v1.PiecePacket) error
Recv() (*v1.PieceTaskRequest, error)
grpc.ServerStream
}
type seederSyncPieceTasksServer struct {
grpc.ServerStream
}
func (x *seederSyncPieceTasksServer) Send(m *v1.PiecePacket) error {
return x.ServerStream.SendMsg(m)
}
func (x *seederSyncPieceTasksServer) Recv() (*v1.PieceTaskRequest, error) {
m := new(v1.PieceTaskRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
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",
}