From afcc2ed9ea8b7018b4d7915f0b22b8cdd7c6eeae Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 9 Dec 2023 16:32:39 +0700 Subject: [PATCH 1/6] save --- downloader/downloader.proto | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index 2f0577c..462526c 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -8,7 +8,12 @@ option go_package = "./downloader;downloader"; package downloader; service Downloader { - rpc Download (DownloadRequest) returns (google.protobuf.Empty) {} + // Erigon's invariant: download new files only at first sync cycle. All other files erigon produce by self and seed. + // after this request: downloader will skip all download requests - if corresponding file doesn't exists on FS yet. + // But next things will work: add new file for seeding, download some uncomplete parts of existing files (because of Verify found some bad parts) + rpc ProhibitNewDownloads (ProhibitNewDownloadsRequest) returns (google.protobuf.Empty) {} + + rpc Add (AddRequest) returns (google.protobuf.Empty) {} rpc Delete (DeleteRequest) returns (google.protobuf.Empty) {} rpc Verify (VerifyRequest) returns (google.protobuf.Empty) {} rpc Stats (StatsRequest) returns (StatsReply) {} @@ -17,12 +22,12 @@ service Downloader { // DownloadItem: // - if Erigon created new snapshot and want seed it // - if Erigon wnat download files - it fills only "torrent_hash" field -message DownloadItem { +message AddItem { string path = 1; types.H160 torrent_hash = 2; // will be resolved as magnet link } -message DownloadRequest { - repeated DownloadItem items = 1; // single hash will be resolved as magnet link +message AddRequest { + repeated AddItem items = 1; // single hash will be resolved as magnet link } // DeleteRequest: stop seeding, delete file, delete .torrent @@ -37,6 +42,9 @@ message VerifyRequest { message StatsRequest { } +message ProhibitNewDownloadsRequest { +} + message StatsReply { // First step on startup - "resolve metadata": // - understand total amount of data to download From aeec5d6602f4a209f10a73138d45beebc97b261b Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 9 Dec 2023 16:38:55 +0700 Subject: [PATCH 2/6] save --- downloader/downloader.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index 462526c..203e03c 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -13,6 +13,7 @@ service Downloader { // But next things will work: add new file for seeding, download some uncomplete parts of existing files (because of Verify found some bad parts) rpc ProhibitNewDownloads (ProhibitNewDownloadsRequest) returns (google.protobuf.Empty) {} + // Adding new file to downloader: non-existing files it will download, existing - seed. rpc Add (AddRequest) returns (google.protobuf.Empty) {} rpc Delete (DeleteRequest) returns (google.protobuf.Empty) {} rpc Verify (VerifyRequest) returns (google.protobuf.Empty) {} From 3c4d7cc5022f7f846c6c4373a6d2453e3b533934 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 9 Dec 2023 17:22:49 +0700 Subject: [PATCH 3/6] save --- downloader/downloader.proto | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index 203e03c..054e33c 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -8,14 +8,16 @@ option go_package = "./downloader;downloader"; package downloader; service Downloader { - // Erigon's invariant: download new files only at first sync cycle. All other files erigon produce by self and seed. - // after this request: downloader will skip all download requests - if corresponding file doesn't exists on FS yet. - // But next things will work: add new file for seeding, download some uncomplete parts of existing files (because of Verify found some bad parts) + // Erigon "download once" - means restart/upgrade will not download files (and will be fast) + // After "download once" - Erigon will produce and seed new files + // Downloader will able: seed new files (already existing on FS), download uncomplete parts of existing files (if Verify found some bad parts) rpc ProhibitNewDownloads (ProhibitNewDownloadsRequest) returns (google.protobuf.Empty) {} // Adding new file to downloader: non-existing files it will download, existing - seed. rpc Add (AddRequest) returns (google.protobuf.Empty) {} rpc Delete (DeleteRequest) returns (google.protobuf.Empty) {} + // Trigger verification of files + // If some part of file is bad - such part will be re-downloaded (without returning error) rpc Verify (VerifyRequest) returns (google.protobuf.Empty) {} rpc Stats (StatsRequest) returns (StatsReply) {} } From dba31e8b6bfd863a5719cc1d54d925aaf4bc046f Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 9 Dec 2023 17:22:57 +0700 Subject: [PATCH 4/6] save --- downloader/downloader.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index 054e33c..393fc57 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -16,6 +16,7 @@ service Downloader { // Adding new file to downloader: non-existing files it will download, existing - seed. rpc Add (AddRequest) returns (google.protobuf.Empty) {} rpc Delete (DeleteRequest) returns (google.protobuf.Empty) {} + // Trigger verification of files // If some part of file is bad - such part will be re-downloaded (without returning error) rpc Verify (VerifyRequest) returns (google.protobuf.Empty) {} From b17e86fbe07d2ffcf41bbd41d4dd0dc3f8b829f2 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 9 Dec 2023 17:23:05 +0700 Subject: [PATCH 5/6] save --- downloader/downloader.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index 393fc57..7dee998 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -13,7 +13,7 @@ service Downloader { // Downloader will able: seed new files (already existing on FS), download uncomplete parts of existing files (if Verify found some bad parts) rpc ProhibitNewDownloads (ProhibitNewDownloadsRequest) returns (google.protobuf.Empty) {} - // Adding new file to downloader: non-existing files it will download, existing - seed. + // Adding new file to downloader: non-existing files it will download, existing - seed rpc Add (AddRequest) returns (google.protobuf.Empty) {} rpc Delete (DeleteRequest) returns (google.protobuf.Empty) {} From a45ec000dbfc33c512339fb31a7f5fe9de9094a4 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 9 Dec 2023 17:29:56 +0700 Subject: [PATCH 6/6] save --- downloader/downloader.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index 7dee998..7ee805e 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -8,7 +8,7 @@ option go_package = "./downloader;downloader"; package downloader; service Downloader { - // Erigon "download once" - means restart/upgrade will not download files (and will be fast) + // Erigon "download once" - means restart/upgrade/downgrade will not download files (and will be fast) // After "download once" - Erigon will produce and seed new files // Downloader will able: seed new files (already existing on FS), download uncomplete parts of existing files (if Verify found some bad parts) rpc ProhibitNewDownloads (ProhibitNewDownloadsRequest) returns (google.protobuf.Empty) {}