diff --git a/syncing/downloader/proto/downloader.pb.go b/syncing/downloader/proto/downloader.pb.go new file mode 100644 index 000000000..f5610f28d --- /dev/null +++ b/syncing/downloader/proto/downloader.pb.go @@ -0,0 +1,240 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: downloader.proto + +package downloader + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type DownloaderRequest_RequestType int32 + +const ( + DownloaderRequest_HEADER DownloaderRequest_RequestType = 0 + DownloaderRequest_BLOCK DownloaderRequest_RequestType = 1 + DownloaderRequest_UNKOWN DownloaderRequest_RequestType = 2 +) + +var DownloaderRequest_RequestType_name = map[int32]string{ + 0: "HEADER", + 1: "BLOCK", + 2: "UNKOWN", +} + +var DownloaderRequest_RequestType_value = map[string]int32{ + "HEADER": 0, + "BLOCK": 1, + "UNKOWN": 2, +} + +func (x DownloaderRequest_RequestType) String() string { + return proto.EnumName(DownloaderRequest_RequestType_name, int32(x)) +} + +func (DownloaderRequest_RequestType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_6a99ec95c7ab1ff1, []int{0, 0} +} + +// DownloaderRequest is the generic download request. +type DownloaderRequest struct { + // Request type. + Type DownloaderRequest_RequestType `protobuf:"varint,1,opt,name=type,proto3,enum=downloader.DownloaderRequest_RequestType" json:"type,omitempty"` + // The array of ids or heights of the blocks we want to download. + Height []int32 `protobuf:"varint,2,rep,packed,name=height,proto3" json:"height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DownloaderRequest) Reset() { *m = DownloaderRequest{} } +func (m *DownloaderRequest) String() string { return proto.CompactTextString(m) } +func (*DownloaderRequest) ProtoMessage() {} +func (*DownloaderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6a99ec95c7ab1ff1, []int{0} +} + +func (m *DownloaderRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DownloaderRequest.Unmarshal(m, b) +} +func (m *DownloaderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DownloaderRequest.Marshal(b, m, deterministic) +} +func (m *DownloaderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DownloaderRequest.Merge(m, src) +} +func (m *DownloaderRequest) XXX_Size() int { + return xxx_messageInfo_DownloaderRequest.Size(m) +} +func (m *DownloaderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DownloaderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DownloaderRequest proto.InternalMessageInfo + +func (m *DownloaderRequest) GetType() DownloaderRequest_RequestType { + if m != nil { + return m.Type + } + return DownloaderRequest_HEADER +} + +func (m *DownloaderRequest) GetHeight() []int32 { + if m != nil { + return m.Height + } + return nil +} + +// DownloaderResponse is the generic response of DownloaderRequest. +type DownloaderResponse struct { + // payload of Block. + Payload [][]byte `protobuf:"bytes,1,rep,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DownloaderResponse) Reset() { *m = DownloaderResponse{} } +func (m *DownloaderResponse) String() string { return proto.CompactTextString(m) } +func (*DownloaderResponse) ProtoMessage() {} +func (*DownloaderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6a99ec95c7ab1ff1, []int{1} +} + +func (m *DownloaderResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DownloaderResponse.Unmarshal(m, b) +} +func (m *DownloaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DownloaderResponse.Marshal(b, m, deterministic) +} +func (m *DownloaderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DownloaderResponse.Merge(m, src) +} +func (m *DownloaderResponse) XXX_Size() int { + return xxx_messageInfo_DownloaderResponse.Size(m) +} +func (m *DownloaderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DownloaderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DownloaderResponse proto.InternalMessageInfo + +func (m *DownloaderResponse) GetPayload() [][]byte { + if m != nil { + return m.Payload + } + return nil +} + +func init() { + proto.RegisterEnum("downloader.DownloaderRequest_RequestType", DownloaderRequest_RequestType_name, DownloaderRequest_RequestType_value) + proto.RegisterType((*DownloaderRequest)(nil), "downloader.DownloaderRequest") + proto.RegisterType((*DownloaderResponse)(nil), "downloader.DownloaderResponse") +} + +func init() { proto.RegisterFile("downloader.proto", fileDescriptor_6a99ec95c7ab1ff1) } + +var fileDescriptor_6a99ec95c7ab1ff1 = []byte{ + // 213 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xc9, 0x2f, 0xcf, + 0xcb, 0xc9, 0x4f, 0x4c, 0x49, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88, + 0x28, 0xcd, 0x61, 0xe4, 0x12, 0x74, 0x81, 0x73, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, + 0x6c, 0xb9, 0x58, 0x4a, 0x2a, 0x0b, 0x52, 0x25, 0x18, 0x15, 0x18, 0x35, 0xf8, 0x8c, 0x34, 0xf5, + 0x90, 0x8c, 0xc0, 0x50, 0xac, 0x07, 0xa5, 0x43, 0x2a, 0x0b, 0x52, 0x83, 0xc0, 0xda, 0x84, 0xc4, + 0xb8, 0xd8, 0x32, 0x52, 0x33, 0xd3, 0x33, 0x4a, 0x24, 0x98, 0x14, 0x98, 0x35, 0x58, 0x83, 0xa0, + 0x3c, 0x25, 0x03, 0x2e, 0x6e, 0x24, 0xc5, 0x42, 0x5c, 0x5c, 0x6c, 0x1e, 0xae, 0x8e, 0x2e, 0xae, + 0x41, 0x02, 0x0c, 0x42, 0x9c, 0x5c, 0xac, 0x4e, 0x3e, 0xfe, 0xce, 0xde, 0x02, 0x8c, 0x20, 0xe1, + 0x50, 0x3f, 0x6f, 0xff, 0x70, 0x3f, 0x01, 0x26, 0x25, 0x3d, 0x2e, 0x21, 0x64, 0x0b, 0x8b, 0x0b, + 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0x24, 0xb8, 0xd8, 0x0b, 0x12, 0x2b, 0x41, 0x82, 0x12, 0x8c, 0x0a, + 0xcc, 0x1a, 0x3c, 0x41, 0x30, 0xae, 0x51, 0x18, 0x17, 0x17, 0x42, 0xbd, 0x90, 0x07, 0x17, 0x6b, + 0x60, 0x69, 0x6a, 0x51, 0xa5, 0x90, 0x2c, 0x5e, 0x1f, 0x48, 0xc9, 0xe1, 0x92, 0x86, 0xd8, 0xa7, + 0xc4, 0x90, 0xc4, 0x06, 0x0e, 0x39, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x6d, 0x18, + 0x54, 0x4d, 0x01, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// 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.SupportPackageIsVersion4 + +// DownloaderClient is the client API for Downloader service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type DownloaderClient interface { + Query(ctx context.Context, in *DownloaderRequest, opts ...grpc.CallOption) (*DownloaderResponse, error) +} + +type downloaderClient struct { + cc *grpc.ClientConn +} + +func NewDownloaderClient(cc *grpc.ClientConn) DownloaderClient { + return &downloaderClient{cc} +} + +func (c *downloaderClient) Query(ctx context.Context, in *DownloaderRequest, opts ...grpc.CallOption) (*DownloaderResponse, error) { + out := new(DownloaderResponse) + err := c.cc.Invoke(ctx, "/downloader.Downloader/Query", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DownloaderServer is the server API for Downloader service. +type DownloaderServer interface { + Query(context.Context, *DownloaderRequest) (*DownloaderResponse, error) +} + +func RegisterDownloaderServer(s *grpc.Server, srv DownloaderServer) { + s.RegisterService(&_Downloader_serviceDesc, srv) +} + +func _Downloader_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DownloaderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DownloaderServer).Query(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/downloader.Downloader/Query", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DownloaderServer).Query(ctx, req.(*DownloaderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Downloader_serviceDesc = grpc.ServiceDesc{ + ServiceName: "downloader.Downloader", + HandlerType: (*DownloaderServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Query", + Handler: _Downloader_Query_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "downloader.proto", +} diff --git a/syncing/downloader/proto/downloader.proto b/syncing/downloader/proto/downloader.proto new file mode 100644 index 000000000..3b8b4658b --- /dev/null +++ b/syncing/downloader/proto/downloader.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +package downloader; + +// Downloader is the service used for downloading/sycning blocks. +service Downloader { + rpc Query(DownloaderRequest) returns (DownloaderResponse) {} +} + +// DownloaderRequest is the generic download request. +message DownloaderRequest { + enum RequestType { + HEADER = 0; + BLOCK = 1; + UNKOWN = 2; + } + + // Request type. + RequestType type = 1; + + // The array of ids or heights of the blocks we want to download. + repeated int32 height = 2; +} + +// DownloaderResponse is the generic response of DownloaderRequest. +message DownloaderResponse { + // payload of Block. + repeated bytes payload = 1; +}