mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
d41d523050
"whitelisting" mechanism (list of files - stored in DB) - which protecting us from downloading new files after upgrade/downgrade was broken. And seems it became over-complicated with time. I replacing it by 1 persistent flag inside downloader: "prohibit_new_downloads.lock" Erigon will turn downloader into this mode after downloading/verification of first snapshots. ``` //Corner cases: // - Erigon generated file X with hash H1. User upgraded Erigon. New version has preverified file X with hash H2. Must ignore H2 (don't send to Downloader) // - Erigon "download once": means restart/upgrade/downgrade must not download files (and will be fast) // - After "download once" - Erigon will produce and seed new files ``` ------ `downloader --seedbox` is never "prohibit new downloads"
51 lines
1.9 KiB
Go
51 lines
1.9 KiB
Go
/*
|
|
Copyright 2021 Erigon contributors
|
|
|
|
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.
|
|
*/
|
|
|
|
package direct
|
|
|
|
import (
|
|
"context"
|
|
|
|
proto_downloader "github.com/ledgerwatch/erigon-lib/gointerfaces/downloader"
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/protobuf/types/known/emptypb"
|
|
)
|
|
|
|
type DownloaderClient struct {
|
|
server proto_downloader.DownloaderServer
|
|
}
|
|
|
|
func NewDownloaderClient(server proto_downloader.DownloaderServer) *DownloaderClient {
|
|
return &DownloaderClient{server: server}
|
|
}
|
|
|
|
func (c *DownloaderClient) Add(ctx context.Context, in *proto_downloader.AddRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
return c.server.Add(ctx, in)
|
|
}
|
|
|
|
func (c *DownloaderClient) ProhibitNewDownloads(ctx context.Context, in *proto_downloader.ProhibitNewDownloadsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
return c.server.ProhibitNewDownloads(ctx, in)
|
|
}
|
|
func (c *DownloaderClient) Delete(ctx context.Context, in *proto_downloader.DeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
return c.server.Delete(ctx, in)
|
|
}
|
|
func (c *DownloaderClient) Verify(ctx context.Context, in *proto_downloader.VerifyRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
return c.server.Verify(ctx, in)
|
|
}
|
|
func (c *DownloaderClient) Stats(ctx context.Context, in *proto_downloader.StatsRequest, opts ...grpc.CallOption) (*proto_downloader.StatsReply, error) {
|
|
return c.server.Stats(ctx, in)
|
|
}
|