add downloader.proto (#206)

* Remove interfaces for replacement

* Squashed 'interfaces/' content from commit be07fc9

git-subtree-dir: interfaces
git-subtree-split: be07fc99183a7cef1ca08961033bdb917d85d9b5

* save

* Remove interfaces for replacement

* Squashed 'interfaces/' content from commit be07fc9

git-subtree-dir: interfaces
git-subtree-split: be07fc99183a7cef1ca08961033bdb917d85d9b5

* Remove interfaces for replacement

* Squashed 'interfaces/' content from commit 23d68fd

git-subtree-dir: interfaces
git-subtree-split: 23d68fda86c3a2c322e7b430c817b06b6f6ca311

* Remove interfaces for replacement

* Squashed 'interfaces/' content from commit 500dde8

git-subtree-dir: interfaces
git-subtree-split: 500dde8293c0a12d19d94b5ff633722a03d7fc4e

* save

* Remove interfaces for replacement

* Squashed 'interfaces/' content from commit e5b1945

git-subtree-dir: interfaces
git-subtree-split: e5b1945d02da7a7f00e2289034ee90a6edd60184

* save

* Remove interfaces for replacement

* Squashed 'interfaces/' content from commit f36d878

git-subtree-dir: interfaces
git-subtree-split: f36d878080fe018a41fb903f81fc8f8ac9981cbd

* save

* save

* save
This commit is contained in:
Alex Sharov 2021-12-14 20:33:32 +07:00 committed by GitHub
parent c7cd5d65d3
commit bb6dfef7c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 472 additions and 537 deletions

View File

@ -32,7 +32,7 @@ grpc:
--go-grpc_opt=Mtypes/types.proto=github.com/ledgerwatch/erigon-lib/gointerfaces/types \
p2psentry/sentry.proto \
remote/kv.proto remote/ethbackend.proto \
snapshot_downloader/external_downloader.proto \
downloader/downloader.proto \
consensus_engine/consensus.proto \
testing/testing.proto \
txpool/txpool.proto txpool/mining.proto

View File

@ -0,0 +1,405 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.18.0
// source: downloader/downloader.proto
package downloader
import (
types "github.com/ledgerwatch/erigon-lib/gointerfaces/types"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb"
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 DownloadItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
TorrentHash *types.H160 `protobuf:"bytes,2,opt,name=torrent_hash,json=torrentHash,proto3" json:"torrent_hash,omitempty"` // single hash will be resolved as magnet link
}
func (x *DownloadItem) Reset() {
*x = DownloadItem{}
if protoimpl.UnsafeEnabled {
mi := &file_downloader_downloader_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DownloadItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DownloadItem) ProtoMessage() {}
func (x *DownloadItem) ProtoReflect() protoreflect.Message {
mi := &file_downloader_downloader_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 DownloadItem.ProtoReflect.Descriptor instead.
func (*DownloadItem) Descriptor() ([]byte, []int) {
return file_downloader_downloader_proto_rawDescGZIP(), []int{0}
}
func (x *DownloadItem) GetPath() string {
if x != nil {
return x.Path
}
return ""
}
func (x *DownloadItem) GetTorrentHash() *types.H160 {
if x != nil {
return x.TorrentHash
}
return nil
}
type DownloadRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Items []*DownloadItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` // single hash will be resolved as magnet link
}
func (x *DownloadRequest) Reset() {
*x = DownloadRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_downloader_downloader_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DownloadRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DownloadRequest) ProtoMessage() {}
func (x *DownloadRequest) ProtoReflect() protoreflect.Message {
mi := &file_downloader_downloader_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 DownloadRequest.ProtoReflect.Descriptor instead.
func (*DownloadRequest) Descriptor() ([]byte, []int) {
return file_downloader_downloader_proto_rawDescGZIP(), []int{1}
}
func (x *DownloadRequest) GetItems() []*DownloadItem {
if x != nil {
return x.Items
}
return nil
}
type StatsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *StatsRequest) Reset() {
*x = StatsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_downloader_downloader_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StatsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatsRequest) ProtoMessage() {}
func (x *StatsRequest) ProtoReflect() protoreflect.Message {
mi := &file_downloader_downloader_proto_msgTypes[2]
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 StatsRequest.ProtoReflect.Descriptor instead.
func (*StatsRequest) Descriptor() ([]byte, []int) {
return file_downloader_downloader_proto_rawDescGZIP(), []int{2}
}
type StatsReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Completed bool `protobuf:"varint,1,opt,name=completed,proto3" json:"completed,omitempty"`
Progress int32 `protobuf:"varint,2,opt,name=progress,proto3" json:"progress,omitempty"`
Peers int32 `protobuf:"varint,3,opt,name=peers,proto3" json:"peers,omitempty"`
Torrents int32 `protobuf:"varint,4,opt,name=torrents,proto3" json:"torrents,omitempty"`
BytesCompleted uint64 `protobuf:"varint,5,opt,name=bytesCompleted,proto3" json:"bytesCompleted,omitempty"`
BytesTotal uint64 `protobuf:"varint,6,opt,name=bytesTotal,proto3" json:"bytesTotal,omitempty"`
}
func (x *StatsReply) Reset() {
*x = StatsReply{}
if protoimpl.UnsafeEnabled {
mi := &file_downloader_downloader_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StatsReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatsReply) ProtoMessage() {}
func (x *StatsReply) ProtoReflect() protoreflect.Message {
mi := &file_downloader_downloader_proto_msgTypes[3]
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 StatsReply.ProtoReflect.Descriptor instead.
func (*StatsReply) Descriptor() ([]byte, []int) {
return file_downloader_downloader_proto_rawDescGZIP(), []int{3}
}
func (x *StatsReply) GetCompleted() bool {
if x != nil {
return x.Completed
}
return false
}
func (x *StatsReply) GetProgress() int32 {
if x != nil {
return x.Progress
}
return 0
}
func (x *StatsReply) GetPeers() int32 {
if x != nil {
return x.Peers
}
return 0
}
func (x *StatsReply) GetTorrents() int32 {
if x != nil {
return x.Torrents
}
return 0
}
func (x *StatsReply) GetBytesCompleted() uint64 {
if x != nil {
return x.BytesCompleted
}
return 0
}
func (x *StatsReply) GetBytesTotal() uint64 {
if x != nil {
return x.BytesTotal
}
return 0
}
var File_downloader_downloader_proto protoreflect.FileDescriptor
var file_downloader_downloader_proto_rawDesc = []byte{
0x0a, 0x1b, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x2f, 0x64, 0x6f, 0x77,
0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x64,
0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x74, 0x79,
0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x52, 0x0a, 0x0c, 0x44, 0x6f, 0x77,
0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74,
0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x2e, 0x0a,
0x0c, 0x74, 0x6f, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x48, 0x31, 0x36, 0x30,
0x52, 0x0b, 0x74, 0x6f, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x22, 0x41, 0x0a,
0x0f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x2e, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x18, 0x2e, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x77,
0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
0x22, 0x0e, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x22, 0xc0, 0x01, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12,
0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x08, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a,
0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x65, 0x65,
0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x12,
0x1a, 0x0a, 0x08, 0x74, 0x6f, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28,
0x05, 0x52, 0x08, 0x74, 0x6f, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x62,
0x79, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20,
0x01, 0x28, 0x04, 0x52, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65,
0x74, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x54, 0x6f, 0x74, 0x61,
0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x54, 0x6f,
0x74, 0x61, 0x6c, 0x32, 0x8c, 0x01, 0x0a, 0x0a, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64,
0x65, 0x72, 0x12, 0x41, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1b,
0x2e, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x77, 0x6e,
0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d,
0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x18,
0x2e, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x64, 0x6f, 0x77, 0x6e, 0x6c,
0x6f, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79,
0x22, 0x00, 0x42, 0x19, 0x5a, 0x17, 0x2e, 0x2f, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64,
0x65, 0x72, 0x3b, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_downloader_downloader_proto_rawDescOnce sync.Once
file_downloader_downloader_proto_rawDescData = file_downloader_downloader_proto_rawDesc
)
func file_downloader_downloader_proto_rawDescGZIP() []byte {
file_downloader_downloader_proto_rawDescOnce.Do(func() {
file_downloader_downloader_proto_rawDescData = protoimpl.X.CompressGZIP(file_downloader_downloader_proto_rawDescData)
})
return file_downloader_downloader_proto_rawDescData
}
var file_downloader_downloader_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_downloader_downloader_proto_goTypes = []interface{}{
(*DownloadItem)(nil), // 0: downloader.DownloadItem
(*DownloadRequest)(nil), // 1: downloader.DownloadRequest
(*StatsRequest)(nil), // 2: downloader.StatsRequest
(*StatsReply)(nil), // 3: downloader.StatsReply
(*types.H160)(nil), // 4: types.H160
(*emptypb.Empty)(nil), // 5: google.protobuf.Empty
}
var file_downloader_downloader_proto_depIdxs = []int32{
4, // 0: downloader.DownloadItem.torrent_hash:type_name -> types.H160
0, // 1: downloader.DownloadRequest.items:type_name -> downloader.DownloadItem
1, // 2: downloader.Downloader.Download:input_type -> downloader.DownloadRequest
2, // 3: downloader.Downloader.Stats:input_type -> downloader.StatsRequest
5, // 4: downloader.Downloader.Download:output_type -> google.protobuf.Empty
3, // 5: downloader.Downloader.Stats:output_type -> downloader.StatsReply
4, // [4:6] is the sub-list for method output_type
2, // [2:4] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_downloader_downloader_proto_init() }
func file_downloader_downloader_proto_init() {
if File_downloader_downloader_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_downloader_downloader_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DownloadItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_downloader_downloader_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DownloadRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_downloader_downloader_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_downloader_downloader_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatsReply); 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_downloader_downloader_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_downloader_downloader_proto_goTypes,
DependencyIndexes: file_downloader_downloader_proto_depIdxs,
MessageInfos: file_downloader_downloader_proto_msgTypes,
}.Build()
File_downloader_downloader_proto = out.File
file_downloader_downloader_proto_rawDesc = nil
file_downloader_downloader_proto_goTypes = nil
file_downloader_downloader_proto_depIdxs = nil
}

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package snapshotsync
package downloader
import (
context "context"
@ -19,8 +19,8 @@ const _ = grpc.SupportPackageIsVersion7
//
// 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.
type DownloaderClient interface {
Download(ctx context.Context, in *DownloadSnapshotRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
Snapshots(ctx context.Context, in *SnapshotsRequest, opts ...grpc.CallOption) (*SnapshotsInfoReply, error)
Download(ctx context.Context, in *DownloadRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
Stats(ctx context.Context, in *StatsRequest, opts ...grpc.CallOption) (*StatsReply, error)
}
type downloaderClient struct {
@ -31,18 +31,18 @@ func NewDownloaderClient(cc grpc.ClientConnInterface) DownloaderClient {
return &downloaderClient{cc}
}
func (c *downloaderClient) Download(ctx context.Context, in *DownloadSnapshotRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
func (c *downloaderClient) Download(ctx context.Context, in *DownloadRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/snapshotsync.Downloader/Download", in, out, opts...)
err := c.cc.Invoke(ctx, "/downloader.Downloader/Download", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *downloaderClient) Snapshots(ctx context.Context, in *SnapshotsRequest, opts ...grpc.CallOption) (*SnapshotsInfoReply, error) {
out := new(SnapshotsInfoReply)
err := c.cc.Invoke(ctx, "/snapshotsync.Downloader/Snapshots", in, out, opts...)
func (c *downloaderClient) Stats(ctx context.Context, in *StatsRequest, opts ...grpc.CallOption) (*StatsReply, error) {
out := new(StatsReply)
err := c.cc.Invoke(ctx, "/downloader.Downloader/Stats", in, out, opts...)
if err != nil {
return nil, err
}
@ -53,8 +53,8 @@ func (c *downloaderClient) Snapshots(ctx context.Context, in *SnapshotsRequest,
// All implementations must embed UnimplementedDownloaderServer
// for forward compatibility
type DownloaderServer interface {
Download(context.Context, *DownloadSnapshotRequest) (*emptypb.Empty, error)
Snapshots(context.Context, *SnapshotsRequest) (*SnapshotsInfoReply, error)
Download(context.Context, *DownloadRequest) (*emptypb.Empty, error)
Stats(context.Context, *StatsRequest) (*StatsReply, error)
mustEmbedUnimplementedDownloaderServer()
}
@ -62,11 +62,11 @@ type DownloaderServer interface {
type UnimplementedDownloaderServer struct {
}
func (UnimplementedDownloaderServer) Download(context.Context, *DownloadSnapshotRequest) (*emptypb.Empty, error) {
func (UnimplementedDownloaderServer) Download(context.Context, *DownloadRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Download not implemented")
}
func (UnimplementedDownloaderServer) Snapshots(context.Context, *SnapshotsRequest) (*SnapshotsInfoReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Snapshots not implemented")
func (UnimplementedDownloaderServer) Stats(context.Context, *StatsRequest) (*StatsReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Stats not implemented")
}
func (UnimplementedDownloaderServer) mustEmbedUnimplementedDownloaderServer() {}
@ -82,7 +82,7 @@ func RegisterDownloaderServer(s grpc.ServiceRegistrar, srv DownloaderServer) {
}
func _Downloader_Download_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DownloadSnapshotRequest)
in := new(DownloadRequest)
if err := dec(in); err != nil {
return nil, err
}
@ -91,28 +91,28 @@ func _Downloader_Download_Handler(srv interface{}, ctx context.Context, dec func
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/snapshotsync.Downloader/Download",
FullMethod: "/downloader.Downloader/Download",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DownloaderServer).Download(ctx, req.(*DownloadSnapshotRequest))
return srv.(DownloaderServer).Download(ctx, req.(*DownloadRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Downloader_Snapshots_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SnapshotsRequest)
func _Downloader_Stats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DownloaderServer).Snapshots(ctx, in)
return srv.(DownloaderServer).Stats(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/snapshotsync.Downloader/Snapshots",
FullMethod: "/downloader.Downloader/Stats",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DownloaderServer).Snapshots(ctx, req.(*SnapshotsRequest))
return srv.(DownloaderServer).Stats(ctx, req.(*StatsRequest))
}
return interceptor(ctx, in, info, handler)
}
@ -121,7 +121,7 @@ func _Downloader_Snapshots_Handler(srv interface{}, ctx context.Context, dec fun
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Downloader_ServiceDesc = grpc.ServiceDesc{
ServiceName: "snapshotsync.Downloader",
ServiceName: "downloader.Downloader",
HandlerType: (*DownloaderServer)(nil),
Methods: []grpc.MethodDesc{
{
@ -129,10 +129,10 @@ var Downloader_ServiceDesc = grpc.ServiceDesc{
Handler: _Downloader_Download_Handler,
},
{
MethodName: "Snapshots",
Handler: _Downloader_Snapshots_Handler,
MethodName: "Stats",
Handler: _Downloader_Stats_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "snapshot_downloader/external_downloader.proto",
Metadata: "downloader/downloader.proto",
}

View File

@ -1,470 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.18.0
// source: snapshot_downloader/external_downloader.proto
package snapshotsync
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb"
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 SnapshotType int32
const (
SnapshotType_headers SnapshotType = 0
SnapshotType_bodies SnapshotType = 1
SnapshotType_state SnapshotType = 2
SnapshotType_receipts SnapshotType = 3
)
// Enum value maps for SnapshotType.
var (
SnapshotType_name = map[int32]string{
0: "headers",
1: "bodies",
2: "state",
3: "receipts",
}
SnapshotType_value = map[string]int32{
"headers": 0,
"bodies": 1,
"state": 2,
"receipts": 3,
}
)
func (x SnapshotType) Enum() *SnapshotType {
p := new(SnapshotType)
*p = x
return p
}
func (x SnapshotType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (SnapshotType) Descriptor() protoreflect.EnumDescriptor {
return file_snapshot_downloader_external_downloader_proto_enumTypes[0].Descriptor()
}
func (SnapshotType) Type() protoreflect.EnumType {
return &file_snapshot_downloader_external_downloader_proto_enumTypes[0]
}
func (x SnapshotType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use SnapshotType.Descriptor instead.
func (SnapshotType) EnumDescriptor() ([]byte, []int) {
return file_snapshot_downloader_external_downloader_proto_rawDescGZIP(), []int{0}
}
type DownloadSnapshotRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
NetworkId uint64 `protobuf:"varint,1,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"`
Type []SnapshotType `protobuf:"varint,2,rep,packed,name=type,proto3,enum=snapshotsync.SnapshotType" json:"type,omitempty"`
}
func (x *DownloadSnapshotRequest) Reset() {
*x = DownloadSnapshotRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_snapshot_downloader_external_downloader_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DownloadSnapshotRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DownloadSnapshotRequest) ProtoMessage() {}
func (x *DownloadSnapshotRequest) ProtoReflect() protoreflect.Message {
mi := &file_snapshot_downloader_external_downloader_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 DownloadSnapshotRequest.ProtoReflect.Descriptor instead.
func (*DownloadSnapshotRequest) Descriptor() ([]byte, []int) {
return file_snapshot_downloader_external_downloader_proto_rawDescGZIP(), []int{0}
}
func (x *DownloadSnapshotRequest) GetNetworkId() uint64 {
if x != nil {
return x.NetworkId
}
return 0
}
func (x *DownloadSnapshotRequest) GetType() []SnapshotType {
if x != nil {
return x.Type
}
return nil
}
type SnapshotsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
NetworkId uint64 `protobuf:"varint,1,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"`
}
func (x *SnapshotsRequest) Reset() {
*x = SnapshotsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_snapshot_downloader_external_downloader_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SnapshotsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SnapshotsRequest) ProtoMessage() {}
func (x *SnapshotsRequest) ProtoReflect() protoreflect.Message {
mi := &file_snapshot_downloader_external_downloader_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 SnapshotsRequest.ProtoReflect.Descriptor instead.
func (*SnapshotsRequest) Descriptor() ([]byte, []int) {
return file_snapshot_downloader_external_downloader_proto_rawDescGZIP(), []int{1}
}
func (x *SnapshotsRequest) GetNetworkId() uint64 {
if x != nil {
return x.NetworkId
}
return 0
}
type SnapshotsInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Type SnapshotType `protobuf:"varint,1,opt,name=type,proto3,enum=snapshotsync.SnapshotType" json:"type,omitempty"`
GotInfoByte bool `protobuf:"varint,2,opt,name=gotInfoByte,proto3" json:"gotInfoByte,omitempty"`
Readiness int32 `protobuf:"varint,3,opt,name=readiness,proto3" json:"readiness,omitempty"`
SnapshotBlock uint64 `protobuf:"varint,4,opt,name=snapshotBlock,proto3" json:"snapshotBlock,omitempty"`
Dbpath string `protobuf:"bytes,5,opt,name=dbpath,proto3" json:"dbpath,omitempty"`
}
func (x *SnapshotsInfo) Reset() {
*x = SnapshotsInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_snapshot_downloader_external_downloader_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SnapshotsInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SnapshotsInfo) ProtoMessage() {}
func (x *SnapshotsInfo) ProtoReflect() protoreflect.Message {
mi := &file_snapshot_downloader_external_downloader_proto_msgTypes[2]
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 SnapshotsInfo.ProtoReflect.Descriptor instead.
func (*SnapshotsInfo) Descriptor() ([]byte, []int) {
return file_snapshot_downloader_external_downloader_proto_rawDescGZIP(), []int{2}
}
func (x *SnapshotsInfo) GetType() SnapshotType {
if x != nil {
return x.Type
}
return SnapshotType_headers
}
func (x *SnapshotsInfo) GetGotInfoByte() bool {
if x != nil {
return x.GotInfoByte
}
return false
}
func (x *SnapshotsInfo) GetReadiness() int32 {
if x != nil {
return x.Readiness
}
return 0
}
func (x *SnapshotsInfo) GetSnapshotBlock() uint64 {
if x != nil {
return x.SnapshotBlock
}
return 0
}
func (x *SnapshotsInfo) GetDbpath() string {
if x != nil {
return x.Dbpath
}
return ""
}
type SnapshotsInfoReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Info []*SnapshotsInfo `protobuf:"bytes,1,rep,name=info,proto3" json:"info,omitempty"`
}
func (x *SnapshotsInfoReply) Reset() {
*x = SnapshotsInfoReply{}
if protoimpl.UnsafeEnabled {
mi := &file_snapshot_downloader_external_downloader_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SnapshotsInfoReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SnapshotsInfoReply) ProtoMessage() {}
func (x *SnapshotsInfoReply) ProtoReflect() protoreflect.Message {
mi := &file_snapshot_downloader_external_downloader_proto_msgTypes[3]
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 SnapshotsInfoReply.ProtoReflect.Descriptor instead.
func (*SnapshotsInfoReply) Descriptor() ([]byte, []int) {
return file_snapshot_downloader_external_downloader_proto_rawDescGZIP(), []int{3}
}
func (x *SnapshotsInfoReply) GetInfo() []*SnapshotsInfo {
if x != nil {
return x.Info
}
return nil
}
var File_snapshot_downloader_external_downloader_proto protoreflect.FileDescriptor
var file_snapshot_downloader_external_downloader_proto_rawDesc = []byte{
0x0a, 0x2d, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x6c,
0x6f, 0x61, 0x64, 0x65, 0x72, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64,
0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x0c, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x1a, 0x1b, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65,
0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x68, 0x0a, 0x17, 0x44, 0x6f,
0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6e, 0x65, 0x74, 0x77, 0x6f,
0x72, 0x6b, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x73, 0x79, 0x6e,
0x63, 0x2e, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04,
0x74, 0x79, 0x70, 0x65, 0x22, 0x31, 0x0a, 0x10, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, 0x74, 0x77,
0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6e, 0x65,
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x64, 0x22, 0xbd, 0x01, 0x0a, 0x0d, 0x53, 0x6e, 0x61, 0x70,
0x73, 0x68, 0x6f, 0x74, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68,
0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x54,
0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x67, 0x6f, 0x74,
0x49, 0x6e, 0x66, 0x6f, 0x42, 0x79, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b,
0x67, 0x6f, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x79, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72,
0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09,
0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x6e, 0x61,
0x70, 0x73, 0x68, 0x6f, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04,
0x52, 0x0d, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12,
0x16, 0x0a, 0x06, 0x64, 0x62, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x06, 0x64, 0x62, 0x70, 0x61, 0x74, 0x68, 0x22, 0x45, 0x0a, 0x12, 0x53, 0x6e, 0x61, 0x70, 0x73,
0x68, 0x6f, 0x74, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x2f, 0x0a,
0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6e,
0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x53, 0x6e, 0x61, 0x70, 0x73,
0x68, 0x6f, 0x74, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x2a, 0x40,
0x0a, 0x0c, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b,
0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x62,
0x6f, 0x64, 0x69, 0x65, 0x73, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65,
0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x10, 0x03,
0x32, 0xaa, 0x01, 0x0a, 0x0a, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72, 0x12,
0x4b, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x25, 0x2e, 0x73, 0x6e,
0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c,
0x6f, 0x61, 0x64, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x09,
0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x73, 0x6e, 0x61, 0x70,
0x73, 0x68, 0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f,
0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x73, 0x6e, 0x61, 0x70,
0x73, 0x68, 0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f,
0x74, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x1d, 0x5a,
0x1b, 0x2e, 0x2f, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x3b,
0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (
file_snapshot_downloader_external_downloader_proto_rawDescOnce sync.Once
file_snapshot_downloader_external_downloader_proto_rawDescData = file_snapshot_downloader_external_downloader_proto_rawDesc
)
func file_snapshot_downloader_external_downloader_proto_rawDescGZIP() []byte {
file_snapshot_downloader_external_downloader_proto_rawDescOnce.Do(func() {
file_snapshot_downloader_external_downloader_proto_rawDescData = protoimpl.X.CompressGZIP(file_snapshot_downloader_external_downloader_proto_rawDescData)
})
return file_snapshot_downloader_external_downloader_proto_rawDescData
}
var file_snapshot_downloader_external_downloader_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_snapshot_downloader_external_downloader_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_snapshot_downloader_external_downloader_proto_goTypes = []interface{}{
(SnapshotType)(0), // 0: snapshotsync.SnapshotType
(*DownloadSnapshotRequest)(nil), // 1: snapshotsync.DownloadSnapshotRequest
(*SnapshotsRequest)(nil), // 2: snapshotsync.SnapshotsRequest
(*SnapshotsInfo)(nil), // 3: snapshotsync.SnapshotsInfo
(*SnapshotsInfoReply)(nil), // 4: snapshotsync.SnapshotsInfoReply
(*emptypb.Empty)(nil), // 5: google.protobuf.Empty
}
var file_snapshot_downloader_external_downloader_proto_depIdxs = []int32{
0, // 0: snapshotsync.DownloadSnapshotRequest.type:type_name -> snapshotsync.SnapshotType
0, // 1: snapshotsync.SnapshotsInfo.type:type_name -> snapshotsync.SnapshotType
3, // 2: snapshotsync.SnapshotsInfoReply.info:type_name -> snapshotsync.SnapshotsInfo
1, // 3: snapshotsync.Downloader.Download:input_type -> snapshotsync.DownloadSnapshotRequest
2, // 4: snapshotsync.Downloader.Snapshots:input_type -> snapshotsync.SnapshotsRequest
5, // 5: snapshotsync.Downloader.Download:output_type -> google.protobuf.Empty
4, // 6: snapshotsync.Downloader.Snapshots:output_type -> snapshotsync.SnapshotsInfoReply
5, // [5:7] is the sub-list for method output_type
3, // [3:5] 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_snapshot_downloader_external_downloader_proto_init() }
func file_snapshot_downloader_external_downloader_proto_init() {
if File_snapshot_downloader_external_downloader_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_snapshot_downloader_external_downloader_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DownloadSnapshotRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_snapshot_downloader_external_downloader_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SnapshotsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_snapshot_downloader_external_downloader_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SnapshotsInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_snapshot_downloader_external_downloader_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SnapshotsInfoReply); 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_snapshot_downloader_external_downloader_proto_rawDesc,
NumEnums: 1,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_snapshot_downloader_external_downloader_proto_goTypes,
DependencyIndexes: file_snapshot_downloader_external_downloader_proto_depIdxs,
EnumInfos: file_snapshot_downloader_external_downloader_proto_enumTypes,
MessageInfos: file_snapshot_downloader_external_downloader_proto_msgTypes,
}.Build()
File_snapshot_downloader_external_downloader_proto = out.File
file_snapshot_downloader_external_downloader_proto_rawDesc = nil
file_snapshot_downloader_external_downloader_proto_goTypes = nil
file_snapshot_downloader_external_downloader_proto_depIdxs = nil
}

View File

@ -29,7 +29,7 @@ fn main() {
}
if cfg!(feature = "snapshotsync") {
protos.push("snapshot_downloader/external_downloader.proto");
protos.push("downloader/downloader.proto");
}
if cfg!(feature = "txpool") {

View File

@ -0,0 +1,34 @@
syntax = "proto3";
import "google/protobuf/empty.proto";
import "types/types.proto";
option go_package = "./downloader;downloader";
package downloader;
service Downloader {
rpc Download (DownloadRequest) returns (google.protobuf.Empty) {}
rpc Stats (StatsRequest) returns (StatsReply) {}
}
message DownloadItem {
string path = 1;
types.H160 torrent_hash = 2; // single hash will be resolved as magnet link
}
message DownloadRequest {
repeated DownloadItem items = 1; // single hash will be resolved as magnet link
}
message StatsRequest {
}
message StatsReply {
bool completed = 1;
int32 progress = 2;
int32 peers = 3;
int32 torrents = 4;
uint64 bytesCompleted = 5;
uint64 bytesTotal = 6;
}

View File

@ -1,40 +0,0 @@
syntax = "proto3";
import "google/protobuf/empty.proto";
option go_package = "./snapshotsync;snapshotsync";
package snapshotsync;
enum SnapshotType {
headers = 0;
bodies = 1;
state = 2;
receipts = 3;
}
service Downloader {
rpc Download (DownloadSnapshotRequest) returns (google.protobuf.Empty) {}
rpc Snapshots (SnapshotsRequest) returns (SnapshotsInfoReply) {}
}
message DownloadSnapshotRequest {
uint64 network_id = 1;
repeated SnapshotType type = 2;
}
message SnapshotsRequest {
uint64 network_id = 1;
}
message SnapshotsInfo {
SnapshotType type = 1;
bool gotInfoByte = 2;
int32 readiness = 3;
uint64 snapshotBlock = 4;
string dbpath = 5;
}
message SnapshotsInfoReply {
repeated SnapshotsInfo info = 1;
}

View File

@ -34,6 +34,8 @@ import (
"github.com/ledgerwatch/log/v3"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/keepalive"
"google.golang.org/grpc/reflection"
"google.golang.org/protobuf/types/known/emptypb"
@ -368,7 +370,11 @@ func StartGrpc(txPoolServer txpool_proto.TxpoolServer, miningServer txpool_proto
// grpc_prometheus.Register(grpcServer)
//}
healthServer := health.NewServer()
grpc_health_v1.RegisterHealthServer(grpcServer, healthServer)
go func() {
defer healthServer.Shutdown()
if err := grpcServer.Serve(lis); err != nil {
log.Error("private RPC server fail", "err", err)
}