snapshotsync

package
v0.0.0-...-215623d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2021 License: GPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultChunkSize = 1024 * 1024
	LmdbFilename     = "data.mdb"
	MdbxFilename     = "mdbx.dat"
	EpochSize        = 500_000

	//todo It'll be changed after enabling new snapshot generation mechanism
	HeadersSnapshotHash = "0000000000000000000000000000000000000000"
	BlocksSnapshotHash  = "0000000000000000000000000000000000000000"
	StateSnapshotHash   = "0000000000000000000000000000000000000000"

	SnapshotInfoHashPrefix  = "ih"
	SnapshotInfoBytesPrefix = "ib"
)
View Source
const (
	SnapshotBlock  = 11_500_000
	HeaderHash11kk = "0x4d5e647b2d8d3a3c8c1561ebb88734bc5fc3c2941016f810cf218738c0ecd99e"
	Header11kk     = "" /* 1064-byte string literal not displayed */
	Body11kk       = "" /* 78958-byte string literal not displayed */
)
View Source
const (
	StageStart           = 0
	StageGenerate        = 1
	StageReplace         = 2
	StageStopSeeding     = 3
	StageStartSeedingNew = 4
	StagePruneDB         = 5
	StageFinish          = 6
)

Variables

View Source
var (
	TorrentHashes = map[uint64]map[SnapshotType]metainfo.Hash{
		params.MainnetChainConfig.ChainID.Uint64(): {
			SnapshotType_headers: metainfo.NewHashFromHex(HeadersSnapshotHash),
			SnapshotType_bodies:  metainfo.NewHashFromHex(BlocksSnapshotHash),
			SnapshotType_state:   metainfo.NewHashFromHex(StateSnapshotHash),
		},
	}
	ErrInvalidSnapshot = errors.New("this snapshot for this chainID not supported ")
)
View Source
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,
	}
)

Enum value maps for SnapshotType.

View Source
var (
	HeadersPostProcessingStage = stages.SyncStage("post processing")
	Snapshot11kkTD             = []byte{138, 3, 199, 118, 5, 203, 95, 162, 81, 64, 161}
)
View Source
var (
	ErrNotSupportedNetworkID = errors.New("not supported network id")
	ErrNotSupportedSnapshot  = errors.New("not supported snapshot for this network id")
)
View Source
var (
	BucketConfigs = map[SnapshotType]dbutils.BucketsCfg{
		SnapshotType_bodies: {
			dbutils.BlockBodyPrefix: dbutils.BucketConfigItem{},
			dbutils.EthTx:           dbutils.BucketConfigItem{},
		},
		SnapshotType_headers: {
			dbutils.HeadersBucket: dbutils.BucketConfigItem{},
		},
		SnapshotType_state: {
			dbutils.PlainStateBucket: dbutils.BucketConfigItem{
				Flags:                     dbutils.DupSort,
				AutoDupSortKeysConversion: true,
				DupFromLen:                60,
				DupToLen:                  28,
			},
			dbutils.PlainContractCodeBucket: dbutils.BucketConfigItem{},
			dbutils.CodeBucket:              dbutils.BucketConfigItem{},
		},
	}
)
View Source
var DefaultSnapshotMode = SnapshotMode{}
View Source
var File_external_downloader_proto protoreflect.FileDescriptor
View Source
var Trackers = [][]string{{
	"http://35.189.110.210:80/announce",
}, {
	"udp://tracker.openbittorrent.com:80",
	"udp://tracker.openbittorrent.com:80",
	"udp://tracker.publicbt.com:80",
	"udp://coppersurfer.tk:6969/announce",
	"udp://open.demonii.com:1337",
	"http://bttracker.crunchbanglinux.org:6969/announce",
	"udp://wambo.club:1337/announce",
	"udp://tracker.dutchtracking.com:6969/announce",
	"udp://tc.animereactor.ru:8082/announce",
	"udp://tracker.justseed.it:1337/announce",
	"udp://tracker.leechers-paradise.org:6969/announce",
	"udp://tracker.opentrackr.org:1337/announce",
	"https://open.kickasstracker.com:443/announce",
	"udp://tracker.coppersurfer.tk:6969/announce",
	"udp://open.stealth.si:80/announce",
	"http://87.253.152.137/announce",
	"http://91.216.110.47/announce",
	"http://91.217.91.21:3218/announce",
	"http://91.218.230.81:6969/announce",
	"http://93.92.64.5/announce",
	"http://atrack.pow7.com/announce",
	"http://bt.henbt.com:2710/announce",
	"http://bt.pusacg.org:8080/announce",
	"https://tracker.bt-hash.com:443/announce",
	"udp://tracker.leechers-paradise.org:6969",
	"https://182.176.139.129:6969/announce",
	"udp://zephir.monocul.us:6969/announce",
	"https://tracker.dutchtracking.com:80/announce",
	"https://grifon.info:80/announce",
	"udp://tracker.kicks-ass.net:80/announce",
	"udp://p4p.arenabg.com:1337/announce",
	"udp://tracker.aletorrenty.pl:2710/announce",
	"udp://tracker.sktorrent.net:6969/announce",
	"udp://tracker.internetwarriors.net:1337/announce",
	"https://tracker.parrotsec.org:443/announce",
	"https://tracker.moxing.party:6969/announce",
	"https://tracker.ipv6tracker.ru:80/announce",
	"https://tracker.fastdownload.xyz:443/announce",
	"udp://open.stealth.si:80/announce",
	"https://gwp2-v19.rinet.ru:80/announce",
	"https://tr.kxmp.cf:80/announce",
	"https://explodie.org:6969/announce",
}, {
	"udp://zephir.monocul.us:6969/announce",
	"udp://tracker.torrent.eu.org:451/announce",
	"udp://tracker.uw0.xyz:6969/announce",
	"udp://tracker.cyberia.is:6969/announce",
	"http://tracker.files.fm:6969/announce",
	"udp://tracker.zum.bi:6969/announce",
	"http://tracker.nyap2p.com:8080/announce",
	"udp://opentracker.i2p.rocks:6969/announce",
	"udp://tracker.zerobytes.xyz:1337/announce",
	"https://tracker.tamersunion.org:443/announce",
	"https://w.wwwww.wtf:443/announce",
	"https://tracker.imgoingto.icu:443/announce",
	"udp://blokas.io:6969/announce",
	"udp://api.bitumconference.ru:6969/announce",
	"udp://discord.heihachi.pw:6969/announce",
	"udp://cutiegirl.ru:6969/announce",
	"udp://fe.dealclub.de:6969/announce",
	"udp://ln.mtahost.co:6969/announce",
	"udp://vibe.community:6969/announce",
	"http://vpn.flying-datacenter.de:6969/announce",
	"udp://eliastre100.fr:6969/announce",
	"udp://wassermann.online:6969/announce",
	"udp://retracker.local.msn-net.ru:6969/announce",
	"udp://chanchan.uchuu.co.uk:6969/announce",
	"udp://kanal-4.de:6969/announce",
	"udp://handrew.me:6969/announce",
	"udp://mail.realliferpg.de:6969/announce",
	"udp://bubu.mapfactor.com:6969/announce",
	"udp://mts.tvbit.co:6969/announce",
	"udp://6ahddutb1ucc3cp.ru:6969/announce",
	"udp://adminion.n-blade.ru:6969/announce",
	"udp://contra.sf.ca.us:6969/announce",
	"udp://61626c.net:6969/announce",
	"udp://benouworldtrip.fr:6969/announce",
	"udp://sd-161673.dedibox.fr:6969/announce",
	"udp://cdn-1.gamecoast.org:6969/announce",
	"udp://cdn-2.gamecoast.org:6969/announce",
	"udp://daveking.com:6969/announce",
	"udp://bms-hosxp.com:6969/announce",
	"udp://teamspeak.value-wolf.org:6969/announce",
	"udp://edu.uifr.ru:6969/announce",
	"udp://adm.category5.tv:6969/announce",
	"udp://code2chicken.nl:6969/announce",
	"udp://t1.leech.ie:1337/announce",
	"udp://forever-tracker.zooki.xyz:6969/announce",
	"udp://free-tracker.zooki.xyz:6969/announce",
	"udp://public.publictracker.xyz:6969/announce",
	"udp://public-tracker.zooki.xyz:6969/announce",
	"udp://vps2.avc.cx:7171/announce",
	"udp://tracker.fileparadise.in:1337/announce",
	"udp://tracker.skynetcloud.site:6969/announce",
	"udp://z.mercax.com:53/announce",
	"https://publictracker.pp.ua:443/announce",
	"udp://us-tracker.publictracker.xyz:6969/announce",
	"udp://open.stealth.si:80/announce",
	"http://tracker1.itzmx.com:8080/announce",
	"http://vps02.net.orel.ru:80/announce",
	"http://tracker.gbitt.info:80/announce",
	"http://tracker.bt4g.com:2095/announce",
	"https://tracker.nitrix.me:443/announce",
	"udp://aaa.army:8866/announce",
	"udp://tracker.vulnix.sh:6969/announce",
	"udp://engplus.ru:6969/announce",
	"udp://movies.zsw.ca:6969/announce",
	"udp://storage.groupees.com:6969/announce",
	"udp://nagios.tks.sumy.ua:80/announce",
	"udp://tracker.v6speed.org:6969/announce",
	"udp://47.ip-51-68-199.eu:6969/announce",
	"udp://aruacfilmes.com.br:6969/announce",
	"https://trakx.herokuapp.com:443/announce",
	"udp://inferno.demonoid.is:3391/announce",
	"udp://publictracker.xyz:6969/announce",
	"http://tracker2.itzmx.com:6961/announce",
	"http://tracker3.itzmx.com:6961/announce",
	"udp://retracker.akado-ural.ru:80/announce",
	"udp://tracker-udp.gbitt.info:80/announce",
	"http://h4.trakx.nibba.trade:80/announce",
	"udp://tracker.army:6969/announce",
	"http://tracker.anonwebz.xyz:8080/announce",
	"udp://tracker.shkinev.me:6969/announce",
	"http://0205.uptm.ch:6969/announce",
	"udp://tracker.zooki.xyz:6969/announce",
	"udp://forever.publictracker.xyz:6969/announce",
	"udp://tracker.moeking.me:6969/announce",
	"udp://ultra.zt.ua:6969/announce",
	"udp://tracker.publictracker.xyz:6969/announce",
	"udp://ipv4.tracker.harry.lu:80/announce",
	"udp://u.wwwww.wtf:1/announce",
	"udp://line-net.ru:6969/announce",
	"udp://dpiui.reedlan.com:6969/announce",
	"udp://tracker.zemoj.com:6969/announce",
	"udp://t3.leech.ie:1337/announce",
	"http://t.nyaatracker.com:80/announce",
	"udp://exodus.desync.com:6969/announce",
	"udp://valakas.rollo.dnsabr.com:2710/announce",
	"udp://tracker.ds.is:6969/announce",
	"udp://tracker.opentrackr.org:1337/announce",
	"udp://tracker0.ufibox.com:6969/announce",
	"https://tracker.hama3.net:443/announce",
	"udp://opentor.org:2710/announce",
	"udp://t2.leech.ie:1337/announce",
	"https://1337.abcvg.info:443/announce",
	"udp://git.vulnix.sh:6969/announce",
	"udp://retracker.lanta-net.ru:2710/announce",
	"udp://tracker.lelux.fi:6969/announce",
	"udp://bt1.archive.org:6969/announce",
	"udp://admin.videoenpoche.info:6969/announce",
	"udp://drumkitx.com:6969/announce",
	"udp://tracker.dler.org:6969/announce",
	"udp://koli.services:6969/announce",
	"udp://tracker.dyne.org:6969/announce",
	"http://torrenttracker.nwc.acsalaska.net:6969/announce",
	"udp://rutorrent.frontline-mod.com:6969/announce",
	"http://rt.tace.ru:80/announce",
	"udp://explodie.org:6969/announce",
}, {
	"udp://public.popcorn-tracker.org:6969/announce",
	"http://104.28.1.30:8080/announce",
	"http://104.28.16.69/announce",
	"http://107.150.14.110:6969/announce",
	"http://109.121.134.121:1337/announce",
	"http://114.55.113.60:6969/announce",
	"http://125.227.35.196:6969/announce",
	"http://128.199.70.66:5944/announce",
	"http://157.7.202.64:8080/announce",
	"http://158.69.146.212:7777/announce",
	"http://173.254.204.71:1096/announce",
	"http://178.175.143.27/announce",
	"http://178.33.73.26:2710/announce",
	"http://182.176.139.129:6969/announce",
	"http://185.5.97.139:8089/announce",
	"http://188.165.253.109:1337/announce",
	"http://194.106.216.222/announce",
	"http://195.123.209.37:1337/announce",
	"http://210.244.71.25:6969/announce",
	"http://210.244.71.26:6969/announce",
	"http://213.159.215.198:6970/announce",
	"http://213.163.67.56:1337/announce",
	"http://37.19.5.139:6969/announce",
	"http://37.19.5.155:6881/announce",
	"http://46.4.109.148:6969/announce",
	"http://5.79.249.77:6969/announce",
	"http://5.79.83.193:2710/announce",
	"http://51.254.244.161:6969/announce",
	"http://59.36.96.77:6969/announce",
	"http://74.82.52.209:6969/announce",
	"http://80.246.243.18:6969/announce",
	"http://81.200.2.231/announce",
	"http://85.17.19.180/announce",
	"http://87.248.186.252:8080/announce",
	"http://87.253.152.137/announce",
	"http://91.216.110.47/announce",
	"http://91.217.91.21:3218/announce",
	"http://91.218.230.81:6969/announce",
	"http://93.92.64.5/announce",
	"http://atrack.pow7.com/announce",
	"http://bt.henbt.com:2710/announce",
	"http://bt.pusacg.org:8080/announce",
	"http://bt2.careland.com.cn:6969/announce",
	"http://explodie.org:6969/announce",
	"http://mgtracker.org:2710/announce",
	"http://mgtracker.org:6969/announce",
	"http://open.acgtracker.com:1096/announce",
	"http://open.lolicon.eu:7777/announce",
	"http://open.touki.ru/announce.php",
	"http://p4p.arenabg.ch:1337/announce",
	"http://p4p.arenabg.com:1337/announce",
	"http://pow7.com:80/announce",
	"http://retracker.gorcomnet.ru/announce",
	"http://retracker.krs-ix.ru/announce",
	"http://retracker.krs-ix.ru:80/announce",
	"http://secure.pow7.com/announce",
	"http://t1.pow7.com/announce",
	"http://t2.pow7.com/announce",
	"http://thetracker.org:80/announce",
	"http://torrent.gresille.org/announce",
	"http://torrentsmd.com:8080/announce",
	"http://tracker.aletorrenty.pl:2710/announce",
	"http://tracker.baravik.org:6970/announce",
	"http://tracker.bittor.pw:1337/announce",
	"http://tracker.bittorrent.am/announce",
	"http://tracker.calculate.ru:6969/announce",
	"http://tracker.dler.org:6969/announce",
	"http://tracker.dutchtracking.com/announce",
	"http://tracker.dutchtracking.com:80/announce",
	"http://tracker.dutchtracking.nl/announce",
	"http://tracker.dutchtracking.nl:80/announce",
	"http://tracker.edoardocolombo.eu:6969/announce",
	"http://tracker.ex.ua/announce",
	"http://tracker.ex.ua:80/announce",
	"http://tracker.filetracker.pl:8089/announce",
	"http://tracker.flashtorrents.org:6969/announce",
	"http://tracker.grepler.com:6969/announce",
	"http://tracker.internetwarriors.net:1337/announce",
	"http://tracker.kicks-ass.net/announce",
	"http://tracker.kicks-ass.net:80/announce",
	"http://tracker.kuroy.me:5944/announce",
	"http://tracker.mg64.net:6881/announce",
	"http://tracker.opentrackr.org:1337/announce",
	"http://tracker.skyts.net:6969/announce",
	"http://tracker.tfile.me/announce",
	"http://tracker.tiny-vps.com:6969/announce",
	"http://tracker.tvunderground.org.ru:3218/announce",
	"http://tracker.yoshi210.com:6969/announc",
	"http://tracker1.wasabii.com.tw:6969/announce",
	"http://tracker2.itzmx.com:6961/announce",
	"http://tracker2.wasabii.com.tw:6969/announce",
	"http://www.wareztorrent.com/announce",
	"http://www.wareztorrent.com:80/announce",
	"https://104.28.17.69/announce",
	"https://www.wareztorrent.com/announce",
	"udp://107.150.14.110:6969/announce",
	"udp://109.121.134.121:1337/announce",
	"udp://114.55.113.60:6969/announce",
	"udp://128.199.70.66:5944/announce",
	"udp://151.80.120.114:2710/announce",
	"udp://168.235.67.63:6969/announce",
	"udp://178.33.73.26:2710/announce",
	"udp://182.176.139.129:6969/announce",
	"udp://185.5.97.139:8089/announce",
	"udp://185.86.149.205:1337/announce",
	"udp://188.165.253.109:1337/announce",
	"udp://191.101.229.236:1337/announce",
	"udp://194.106.216.222:80/announce",
	"udp://195.123.209.37:1337/announce",
	"udp://195.123.209.40:80/announce",
	"udp://208.67.16.113:8000/announce",
	"udp://213.163.67.56:1337/announce",
	"udp://37.19.5.155:2710/announce",
	"udp://46.4.109.148:6969/announce",
	"udp://5.79.249.77:6969/announce",
	"udp://5.79.83.193:6969/announce",
	"udp://51.254.244.161:6969/announce",
	"udp://62.138.0.158:6969/announce",
	"udp://62.212.85.66:2710/announce",
	"udp://74.82.52.209:6969/announce",
	"udp://85.17.19.180:80/announce",
	"udp://89.234.156.205:80/announce",
	"udp://9.rarbg.com:2710/announce",
	"udp://9.rarbg.me:2780/announce",
	"udp://9.rarbg.to:2730/announce",
	"udp://91.218.230.81:6969/announce",
	"udp://94.23.183.33:6969/announce",
	"udp://bt.xxx-tracker.com:2710/announce",
	"udp://eddie4.nl:6969/announce",
	"udp://explodie.org:6969/announce",
	"udp://mgtracker.org:2710/announce",
	"udp://open.stealth.si:80/announce",
	"udp://p4p.arenabg.com:1337/announce",
	"udp://shadowshq.eddie4.nl:6969/announce",
	"udp://shadowshq.yi.org:6969/announce",
	"udp://torrent.gresille.org:80/announce",
	"udp://tracker.aletorrenty.pl:2710/announce",
	"udp://tracker.bittor.pw:1337/announce",
	"udp://tracker.coppersurfer.tk:6969/announce",
	"udp://tracker.eddie4.nl:6969/announce",
	"udp://tracker.ex.ua:80/announce",
	"udp://tracker.filetracker.pl:8089/announce",
	"udp://tracker.flashtorrents.org:6969/announce",
	"udp://tracker.grepler.com:6969/announce",
	"udp://tracker.ilibr.org:80/announce",
	"udp://tracker.internetwarriors.net:1337/announce",
	"udp://tracker.kicks-ass.net:80/announce",
	"udp://tracker.kuroy.me:5944/announce",
	"udp://tracker.leechers-paradise.org:6969/announce",
	"udp://tracker.mg64.net:2710/announce",
	"udp://tracker.mg64.net:6969/announce",
	"udp://tracker.opentrackr.org:1337/announce",
	"udp://tracker.piratepublic.com:1337/announce",
	"udp://tracker.sktorrent.net:6969/announce",
	"udp://tracker.skyts.net:6969/announce",
	"udp://tracker.tiny-vps.com:6969/announce",
	"udp://tracker.yoshi210.com:6969/announce",
	"udp://tracker2.indowebster.com:6969/announce",
	"udp://tracker4.piratux.com:6969/announce",
	"udp://zer0day.ch:1337/announce",
	"udp://zer0day.to:1337/announce",
}}

Functions

func BuildInfoBytesForSnapshot

func BuildInfoBytesForSnapshot(root string, fileName string) (metainfo.Info, error)

func CalculateEpoch

func CalculateEpoch(block, epochSize uint64) uint64

func CreateHeadersSnapshot

func CreateHeadersSnapshot(ctx context.Context, chainDB ethdb.RwKV, toBlock uint64, snapshotPath string, useMdbx bool) error

func DefaultTorrentConfig

func DefaultTorrentConfig() *torrent.ClientConfig

func DownloadSnapshots

func DownloadSnapshots(torrentClient *Client, ExternalSnapshotDownloaderAddr string, networkID uint64, snapshotMode SnapshotMode, chainDb ethdb.Database) error

func GenerateHeaderIndexes

func GenerateHeaderIndexes(ctx context.Context, db ethdb.Database) error

func GenerateHeadersSnapshot

func GenerateHeadersSnapshot(ctx context.Context, db ethdb.Tx, sntx ethdb.RwTx, toBlock uint64) error

func GetSnapshotInfo

func GetSnapshotInfo(db ethdb.Database) (uint64, []byte, error)

func MakeInfoBytesKey

func MakeInfoBytesKey(snapshotName string, networkID uint64) []byte

func MakeInfoHashKey

func MakeInfoHashKey(snapshotName string, networkID uint64) []byte

func NewAdapterLogger

func NewAdapterLogger() lg.Logger

func OpenHeadersSnapshot

func OpenHeadersSnapshot(dbPath string, useMdbx bool) (ethdb.RwKV, error)

func ParseInfoHashKey

func ParseInfoHashKey(k []byte) (uint64, string)

ParseInfoHashKey returns networkID and snapshot name

func PostProcessBodies

func PostProcessBodies(db ethdb.Database) error

func PostProcessNoBlocksSync

func PostProcessNoBlocksSync(db ethdb.Database, blockNum uint64, blockHash common.Hash, blockHeaderBytes, blockBodyBytes []byte) error

It'll be enabled later

func PostProcessState

func PostProcessState(db ethdb.GetterPutter, info *SnapshotsInfo) error

func PostProcessing

func PostProcessing(db ethdb.Database, downloadedSnapshots map[SnapshotType]*SnapshotsInfo) error

func RegisterDownloaderServer

func RegisterDownloaderServer(s grpc.ServiceRegistrar, srv DownloaderServer)

func RemoveHeadersData

func RemoveHeadersData(db ethdb.RwKV, tx ethdb.RwTx, currentSnapshot, newSnapshot uint64) (err error)

func SnapshotName

func SnapshotName(baseDir, name string, blockNum uint64) string

func SnapshotSeeding

func SnapshotSeeding(chainDB ethdb.Database, cli *Client, name string, snapshotsDir string) error

func WrapBySnapshotsFromDir

func WrapBySnapshotsFromDir(kv ethdb.RwKV, snapshotDir string, mode SnapshotMode) (ethdb.RwKV, error)

func WrapBySnapshotsFromDownloader

func WrapBySnapshotsFromDownloader(kv ethdb.RwKV, snapshots map[SnapshotType]*SnapshotsInfo) (ethdb.RwKV, error)

func WrapSnapshots

func WrapSnapshots(chainDb ethdb.Database, snapshotsDir string, useMdbx bool) error

Types

type Client

type Client struct {
	Cli *torrent.Client
	// contains filtered or unexported fields
}

func New

func New(snapshotsDir string, seeding bool, peerID string) (*Client, error)

func (*Client) AddSnapshotsTorrents

func (cli *Client) AddSnapshotsTorrents(ctx context.Context, db ethdb.Database, networkId uint64, mode SnapshotMode) error

func (*Client) AddTorrent

func (cli *Client) AddTorrent(ctx context.Context, db ethdb.Database, snapshotType SnapshotType, networkID uint64) error

func (*Client) AddTorrentSpec

func (cli *Client) AddTorrentSpec(snapshotName string, snapshotHash metainfo.Hash, infoBytes []byte) (*torrent.Torrent, error)

func (*Client) Close

func (cli *Client) Close()

func (*Client) Download

func (cli *Client) Download()

func (*Client) GetInfoBytes

func (cli *Client) GetInfoBytes(ctx context.Context, snapshotHash metainfo.Hash) ([]byte, error)

func (*Client) GetSnapshots

func (cli *Client) GetSnapshots(db ethdb.Database, networkID uint64) (map[SnapshotType]*SnapshotsInfo, error)

func (*Client) Load

func (cli *Client) Load(db ethdb.Database) error

func (*Client) PeerID

func (cli *Client) PeerID() []byte

func (*Client) SavePeerID

func (cli *Client) SavePeerID(db ethdb.Putter) error

func (*Client) SeedSnapshot

func (cli *Client) SeedSnapshot(name string, path string) (metainfo.Hash, error)

func (*Client) StopSeeding

func (cli *Client) StopSeeding(hash metainfo.Hash) error

func (*Client) Torrents

func (cli *Client) Torrents() []metainfo.Hash

type DownloadSnapshotRequest

type DownloadSnapshotRequest struct {
	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"`
	// contains filtered or unexported fields
}

func (*DownloadSnapshotRequest) Descriptor deprecated

func (*DownloadSnapshotRequest) Descriptor() ([]byte, []int)

Deprecated: Use DownloadSnapshotRequest.ProtoReflect.Descriptor instead.

func (*DownloadSnapshotRequest) GetNetworkId

func (x *DownloadSnapshotRequest) GetNetworkId() uint64

func (*DownloadSnapshotRequest) GetType

func (x *DownloadSnapshotRequest) GetType() []SnapshotType

func (*DownloadSnapshotRequest) ProtoMessage

func (*DownloadSnapshotRequest) ProtoMessage()

func (*DownloadSnapshotRequest) ProtoReflect

func (x *DownloadSnapshotRequest) ProtoReflect() protoreflect.Message

func (*DownloadSnapshotRequest) Reset

func (x *DownloadSnapshotRequest) Reset()

func (*DownloadSnapshotRequest) String

func (x *DownloadSnapshotRequest) String() string

type DownloaderClient

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)
}

DownloaderClient is the client API for Downloader service.

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.

func NewClient

func NewClient(addr string) (DownloaderClient, func() error, error)

func NewDownloaderClient

func NewDownloaderClient(cc grpc.ClientConnInterface) DownloaderClient

type DownloaderServer

type DownloaderServer interface {
	Download(context.Context, *DownloadSnapshotRequest) (*emptypb.Empty, error)
	Snapshots(context.Context, *SnapshotsRequest) (*SnapshotsInfoReply, error)
	// contains filtered or unexported methods
}

DownloaderServer is the server API for Downloader service. All implementations must embed UnimplementedDownloaderServer for forward compatibility

type SNDownloaderServer

type SNDownloaderServer struct {
	DownloaderServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(dir string, seeding bool) (*SNDownloaderServer, error)

func (*SNDownloaderServer) Download

func (*SNDownloaderServer) Load

func (S *SNDownloaderServer) Load() error

func (*SNDownloaderServer) Snapshots

func (*SNDownloaderServer) Stats

type SnapshotMigrator

type SnapshotMigrator struct {
	HeadersCurrentSnapshot     uint64
	HeadersNewSnapshot         uint64
	HeadersNewSnapshotInfohash []byte

	Stage uint64
	// contains filtered or unexported fields
}

func NewMigrator

func NewMigrator(snapshotDir string, currentSnapshotBlock uint64, currentSnapshotInfohash []byte, useMdbx bool) *SnapshotMigrator

func (*SnapshotMigrator) Close

func (sm *SnapshotMigrator) Close()

func (*SnapshotMigrator) Finished

func (sm *SnapshotMigrator) Finished(block uint64) bool

func (*SnapshotMigrator) GetStage

func (sm *SnapshotMigrator) GetStage() string

func (*SnapshotMigrator) Migrate

func (sm *SnapshotMigrator) Migrate(db ethdb.RwKV, tx ethdb.RwTx, toBlock uint64, bittorrent *Client) error

func (*SnapshotMigrator) RemoveHeadersData

func (sb *SnapshotMigrator) RemoveHeadersData(db ethdb.RwKV, tx ethdb.RwTx) (err error)

func (*SnapshotMigrator) RemoveNonCurrentSnapshots

func (sm *SnapshotMigrator) RemoveNonCurrentSnapshots() error

func (*SnapshotMigrator) ReplaceHeadersSnapshot

func (sm *SnapshotMigrator) ReplaceHeadersSnapshot(chainDB ethdb.RwKV, snapshotPath string) error

type SnapshotMode

type SnapshotMode struct {
	Headers  bool
	Bodies   bool
	State    bool
	Receipts bool
}

func FromSnapshotTypes

func FromSnapshotTypes(st []SnapshotType) SnapshotMode

func SnapshotModeFromString

func SnapshotModeFromString(flags string) (SnapshotMode, error)

func (SnapshotMode) ToSnapshotTypes

func (m SnapshotMode) ToSnapshotTypes() []SnapshotType

func (SnapshotMode) ToString

func (m SnapshotMode) ToString() string

type SnapshotType

type SnapshotType int32
const (
	SnapshotType_headers  SnapshotType = 0
	SnapshotType_bodies   SnapshotType = 1
	SnapshotType_state    SnapshotType = 2
	SnapshotType_receipts SnapshotType = 3
)

func GetAvailableSnapshotTypes

func GetAvailableSnapshotTypes(chainID uint64) []SnapshotType

func (SnapshotType) Descriptor

func (SnapshotType) Enum

func (x SnapshotType) Enum() *SnapshotType

func (SnapshotType) EnumDescriptor deprecated

func (SnapshotType) EnumDescriptor() ([]byte, []int)

Deprecated: Use SnapshotType.Descriptor instead.

func (SnapshotType) Number

func (SnapshotType) String

func (x SnapshotType) String() string

func (SnapshotType) Type

type SnapshotsInfo

type SnapshotsInfo struct {
	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"`
	// contains filtered or unexported fields
}

func (*SnapshotsInfo) Descriptor deprecated

func (*SnapshotsInfo) Descriptor() ([]byte, []int)

Deprecated: Use SnapshotsInfo.ProtoReflect.Descriptor instead.

func (*SnapshotsInfo) GetDbpath

func (x *SnapshotsInfo) GetDbpath() string

func (*SnapshotsInfo) GetGotInfoByte

func (x *SnapshotsInfo) GetGotInfoByte() bool

func (*SnapshotsInfo) GetReadiness

func (x *SnapshotsInfo) GetReadiness() int32

func (*SnapshotsInfo) GetSnapshotBlock

func (x *SnapshotsInfo) GetSnapshotBlock() uint64

func (*SnapshotsInfo) GetType

func (x *SnapshotsInfo) GetType() SnapshotType

func (*SnapshotsInfo) ProtoMessage

func (*SnapshotsInfo) ProtoMessage()

func (*SnapshotsInfo) ProtoReflect

func (x *SnapshotsInfo) ProtoReflect() protoreflect.Message

func (*SnapshotsInfo) Reset

func (x *SnapshotsInfo) Reset()

func (*SnapshotsInfo) String

func (x *SnapshotsInfo) String() string

type SnapshotsInfoReply

type SnapshotsInfoReply struct {
	Info []*SnapshotsInfo `protobuf:"bytes,1,rep,name=info,proto3" json:"info,omitempty"`
	// contains filtered or unexported fields
}

func (*SnapshotsInfoReply) Descriptor deprecated

func (*SnapshotsInfoReply) Descriptor() ([]byte, []int)

Deprecated: Use SnapshotsInfoReply.ProtoReflect.Descriptor instead.

func (*SnapshotsInfoReply) GetInfo

func (x *SnapshotsInfoReply) GetInfo() []*SnapshotsInfo

func (*SnapshotsInfoReply) ProtoMessage

func (*SnapshotsInfoReply) ProtoMessage()

func (*SnapshotsInfoReply) ProtoReflect

func (x *SnapshotsInfoReply) ProtoReflect() protoreflect.Message

func (*SnapshotsInfoReply) Reset

func (x *SnapshotsInfoReply) Reset()

func (*SnapshotsInfoReply) String

func (x *SnapshotsInfoReply) String() string

type SnapshotsRequest

type SnapshotsRequest struct {
	NetworkId uint64 `protobuf:"varint,1,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"`
	// contains filtered or unexported fields
}

func (*SnapshotsRequest) Descriptor deprecated

func (*SnapshotsRequest) Descriptor() ([]byte, []int)

Deprecated: Use SnapshotsRequest.ProtoReflect.Descriptor instead.

func (*SnapshotsRequest) GetNetworkId

func (x *SnapshotsRequest) GetNetworkId() uint64

func (*SnapshotsRequest) ProtoMessage

func (*SnapshotsRequest) ProtoMessage()

func (*SnapshotsRequest) ProtoReflect

func (x *SnapshotsRequest) ProtoReflect() protoreflect.Message

func (*SnapshotsRequest) Reset

func (x *SnapshotsRequest) Reset()

func (*SnapshotsRequest) String

func (x *SnapshotsRequest) String() string

type UnimplementedDownloaderServer

type UnimplementedDownloaderServer struct {
}

UnimplementedDownloaderServer must be embedded to have forward compatible implementations.

func (UnimplementedDownloaderServer) Download

func (UnimplementedDownloaderServer) Snapshots

type UnsafeDownloaderServer

type UnsafeDownloaderServer interface {
	// contains filtered or unexported methods
}

UnsafeDownloaderServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to DownloaderServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL