Documentation ¶
Index ¶
- Variables
- func AddSegment(originalFileName, snapDir string, client *torrent.Client) (bool, error)
- func AddTorrentFile(torrentFilePath string, torrentClient *torrent.Client) (*torrent.Torrent, error)
- func AllTorrentFiles(dir string) ([]string, error)
- func AllTorrentPaths(dir string) ([]string, error)
- func BuildTorrentFilesIfNeed(ctx context.Context, snapDir string) ([]string, error)
- func CreateTorrentFileIfNotExists(root string, info *metainfo.Info, mi *metainfo.MetaInfo) error
- func NewMdbxPieceCompletion(db kv.RwDB) (ret storage.PieceCompletion, err error)
- func Proto2InfoHash(in *prototypes.H160) metainfo.Hash
- func VerifyDtaFiles(ctx context.Context, snapDir string) error
- type AggStats
- type Downloader
- func (d *Downloader) Close()
- func (d *Downloader) MainLoopInBackground(ctx context.Context, silent bool)
- func (d *Downloader) PeerID() []byte
- func (d *Downloader) ReCalcStats(interval time.Duration)
- func (d *Downloader) SnapDir() string
- func (d *Downloader) Stats() AggStats
- func (d *Downloader) StopSeeding(hash metainfo.Hash) error
- func (d *Downloader) Torrent() *torrent.Client
- type GrpcServer
- func (s *GrpcServer) Download(ctx context.Context, request *proto_downloader.DownloadRequest) (*emptypb.Empty, error)
- func (s *GrpcServer) Stats(ctx context.Context, request *proto_downloader.StatsRequest) (*proto_downloader.StatsReply, error)
- func (s *GrpcServer) Verify(ctx context.Context, request *proto_downloader.VerifyRequest) (*emptypb.Empty, error)
Constants ¶
This section is empty.
Variables ¶
var ErrSkip = fmt.Errorf("skip")
Trackers - break down by priority tier
Functions ¶
func AddSegment ¶
AddSegment - add existing .seg file, create corresponding .torrent if need
func AddTorrentFile ¶
func AddTorrentFile(torrentFilePath string, torrentClient *torrent.Client) (*torrent.Torrent, error)
AddTorrentFile - adding .torrent file to torrentClient (and checking their hashes), if .torrent file added first time - pieces verification process will start (disk IO heavy) - Progress kept in `piece completion storage` (surviving reboot). Once it done - no disk IO needed again. Don't need call torrent.VerifyData manually
func AllTorrentFiles ¶
func AllTorrentPaths ¶
func BuildTorrentFilesIfNeed ¶
BuildTorrentFilesIfNeed - create .torrent files from .seg files (big IO) - if .seg files were added manually
func NewMdbxPieceCompletion ¶
func NewMdbxPieceCompletion(db kv.RwDB) (ret storage.PieceCompletion, err error)
func Proto2InfoHash ¶
func Proto2InfoHash(in *prototypes.H160) metainfo.Hash
Types ¶
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
Downloader - component which downloading historical files. Can use BitTorrent, or other protocols
func New ¶
func New(ctx context.Context, cfg *downloadercfg.Cfg) (*Downloader, error)
func (*Downloader) Close ¶
func (d *Downloader) Close()
func (*Downloader) MainLoopInBackground ¶
func (d *Downloader) MainLoopInBackground(ctx context.Context, silent bool)
func (*Downloader) PeerID ¶
func (d *Downloader) PeerID() []byte
func (*Downloader) ReCalcStats ¶
func (d *Downloader) ReCalcStats(interval time.Duration)
func (*Downloader) SnapDir ¶
func (d *Downloader) SnapDir() string
func (*Downloader) Stats ¶
func (d *Downloader) Stats() AggStats
func (*Downloader) StopSeeding ¶
func (d *Downloader) StopSeeding(hash metainfo.Hash) error
func (*Downloader) Torrent ¶
func (d *Downloader) Torrent() *torrent.Client
type GrpcServer ¶
type GrpcServer struct { proto_downloader.UnimplementedDownloaderServer // contains filtered or unexported fields }
func NewGrpcServer ¶
func NewGrpcServer(d *Downloader) (*GrpcServer, error)
func (*GrpcServer) Download ¶
func (s *GrpcServer) Download(ctx context.Context, request *proto_downloader.DownloadRequest) (*emptypb.Empty, error)
Download - create new .torrent ONLY if initialSync, everything else Erigon can generate by itself
func (*GrpcServer) Stats ¶
func (s *GrpcServer) Stats(ctx context.Context, request *proto_downloader.StatsRequest) (*proto_downloader.StatsReply, error)
func (*GrpcServer) Verify ¶
func (s *GrpcServer) Verify(ctx context.Context, request *proto_downloader.VerifyRequest) (*emptypb.Empty, error)