Documentation ¶
Index ¶
- func BuildProtoRequest(downloadRequest []DownloadRequest) *proto_downloader.AddRequest
- func CanRetire(from, to uint64, snapType snaptype.Enum, chainConfig *chain.Config) (blockFrom, blockTo uint64, can bool)
- func DirtySegmentLess(i, j *DirtySegment) bool
- func FindOverlaps(in []snaptype.FileInfo) (res []snaptype.FileInfo, overlapped []snaptype.FileInfo)
- func NoOverlaps[T SortedRange](in []T) (res []T)
- func RequestSnapshotsDownload(ctx context.Context, downloadRequest []DownloadRequest, ...) error
- func WaitForDownloader(ctx context.Context, logPrefix string, dirs datadir.Dirs, ...) error
- type BlockSnapshots
- type CaplinMode
- type DirtySegment
- func (s *DirtySegment) FileInfo(dir string) snaptype.FileInfo
- func (s *DirtySegment) FileName() string
- func (s *DirtySegment) GetRange() (from, to uint64)
- func (s *DirtySegment) GetType() snaptype.Type
- func (s *DirtySegment) Index(index ...snaptype.Index) *recsplit.Index
- func (s *DirtySegment) IsIndexed() bool
- func (s *DirtySegment) Open(dir string) (err error)
- func (s *DirtySegment) OpenIdxIfNeed(dir string, optimistic bool) (err error)
- func (s *DirtySegment) Type() snaptype.Type
- func (s *DirtySegment) Version() snaptype.Version
- type DownloadRequest
- type Merger
- type Range
- func NewRange(from, to uint64) Range
- func NoGaps[T SortedRange](in []T) (out []T, missingRanges []Range)
- func SegmentsCaplin(dir string, minBlock uint64) (res []snaptype.FileInfo, missingSnapshots []Range, err error)
- func TypedSegments(dir string, minBlock uint64, types []snaptype.Type, allowGaps bool) (res []snaptype.FileInfo, missingSnapshots []Range, err error)
- type Ranges
- type RoSnapshots
- func (s *RoSnapshots) AddSnapshotsToSilkworm(silkwormInstance *silkworm.Silkworm) error
- func (s *RoSnapshots) BlocksAvailable() uint64
- func (s *RoSnapshots) BuildMissedIndices(ctx context.Context, logPrefix string, notifier snapshotNotifier, ...) error
- func (s *RoSnapshots) Cfg() ethconfig.BlocksFreezing
- func (s *RoSnapshots) Close()
- func (s *RoSnapshots) Delete(fileName string) error
- func (s *RoSnapshots) Dir() string
- func (s *RoSnapshots) DirtyBlocksAvailable(t snaptype.Enum) uint64
- func (s *RoSnapshots) DisableReadAhead() *RoSnapshots
- func (s *RoSnapshots) DownloadComplete()
- func (s *RoSnapshots) DownloadReady() bool
- func (s *RoSnapshots) EnableMadvWillNeed() *RoSnapshots
- func (s *RoSnapshots) EnableReadAhead() *RoSnapshots
- func (s *RoSnapshots) EnsureExpectedBlocksAreAvailable(cfg *snapcfg.Cfg) error
- func (s *RoSnapshots) Files() (list []string)
- func (s *RoSnapshots) HasType(in snaptype.Type) bool
- func (s *RoSnapshots) IndexBuilder(t snaptype.Type) snaptype.IndexBuilder
- func (s *RoSnapshots) IndicesMax() uint64
- func (s *RoSnapshots) InitSegments(fileNames []string) error
- func (s *RoSnapshots) LogStat(label string)
- func (s *RoSnapshots) Ls()
- func (s *RoSnapshots) OpenFiles() (list []string)
- func (s *RoSnapshots) OpenFolder() error
- func (s *RoSnapshots) OpenList(fileNames []string, optimistic bool) error
- func (s *RoSnapshots) OpenSegments(types []snaptype.Type, allowGaps bool) error
- func (s *RoSnapshots) OptimisticalyOpenFolder()
- func (s *RoSnapshots) PrintDebug()
- func (s *RoSnapshots) RangeExtractor(t snaptype.Type) snaptype.RangeExtractor
- func (s *RoSnapshots) Ranges() []Range
- func (s *RoSnapshots) Ready(ctx context.Context) <-chan error
- func (s *RoSnapshots) RemoveOldFiles(filesToRemove []string)
- func (s *RoSnapshots) RemoveOverlaps() error
- func (s *RoSnapshots) SegmentsMax() uint64
- func (s *RoSnapshots) SegmentsMin() uint64
- func (s *RoSnapshots) SegmentsReady() bool
- func (s *RoSnapshots) SetIndexBuilder(t snaptype.Type, indexBuilder snaptype.IndexBuilder)
- func (s *RoSnapshots) SetRangeExtractor(t snaptype.Type, rangeExtractor snaptype.RangeExtractor)
- func (s *RoSnapshots) SetSegmentsMin(min uint64)
- func (s *RoSnapshots) Types() []snaptype.Type
- func (s *RoSnapshots) View() *View
- func (s *RoSnapshots) ViewSingleFile(t snaptype.Type, blockNum uint64) (segment *VisibleSegment, ok bool, close func())
- func (s *RoSnapshots) ViewType(t snaptype.Type) *RoTx
- func (s *RoSnapshots) VisibleBlocksAvailable(t snaptype.Enum) uint64
- type RoTx
- type SortedRange
- type View
- type VisibleSegment
- type VisibleSegments
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildProtoRequest ¶
func BuildProtoRequest(downloadRequest []DownloadRequest) *proto_downloader.AddRequest
func DirtySegmentLess ¶
func DirtySegmentLess(i, j *DirtySegment) bool
func FindOverlaps ¶
func NoOverlaps ¶
func NoOverlaps[T SortedRange](in []T) (res []T)
NoOverlaps - keep largest ranges and avoid overlap
func RequestSnapshotsDownload ¶
func RequestSnapshotsDownload(ctx context.Context, downloadRequest []DownloadRequest, downloader proto_downloader.DownloaderClient, logPrefix string) error
RequestSnapshotsDownload - builds the snapshots download request and downloads them
func WaitForDownloader ¶
func WaitForDownloader(ctx context.Context, logPrefix string, dirs datadir.Dirs, headerchain, blobs bool, prune prune.Mode, caplin CaplinMode, agg *state.Aggregator, tx kv.RwTx, blockReader blockReader, cc *chain.Config, snapshotDownloader proto_downloader.DownloaderClient, stagesIdsList []string) error
WaitForDownloader - wait for Downloader service to download all expected snapshots for MVP we sync with Downloader only once, in future will send new snapshots also
Types ¶
type BlockSnapshots ¶
type BlockSnapshots interface { LogStat(label string) OpenFolder() error OpenSegments(types []snaptype.Type, allowGaps bool) error SegmentsMax() uint64 SegmentsMin() uint64 Delete(fileName string) error Types() []snaptype.Type Close() SetSegmentsMin(uint64) DownloadComplete() DownloadReady() bool Ready(context.Context) <-chan error }
type CaplinMode ¶
type CaplinMode int
const ( // CaplinModeNone - no caplin mode NoCaplin CaplinMode = 1 OnlyCaplin CaplinMode = 2 AlsoCaplin CaplinMode = 3 )
type DirtySegment ¶
type DirtySegment struct { Range *seg.Decompressor // contains filtered or unexported fields }
func NewDirtySegment ¶
func (*DirtySegment) FileName ¶
func (s *DirtySegment) FileName() string
func (*DirtySegment) GetRange ¶
func (s *DirtySegment) GetRange() (from, to uint64)
func (*DirtySegment) GetType ¶
func (s *DirtySegment) GetType() snaptype.Type
func (*DirtySegment) IsIndexed ¶
func (s *DirtySegment) IsIndexed() bool
func (*DirtySegment) Open ¶
func (s *DirtySegment) Open(dir string) (err error)
func (*DirtySegment) OpenIdxIfNeed ¶
func (s *DirtySegment) OpenIdxIfNeed(dir string, optimistic bool) (err error)
func (*DirtySegment) Type ¶
func (s *DirtySegment) Type() snaptype.Type
func (*DirtySegment) Version ¶
func (s *DirtySegment) Version() snaptype.Version
type DownloadRequest ¶
func NewDownloadRequest ¶
func NewDownloadRequest(path string, torrentHash string) DownloadRequest
type Merger ¶
type Merger struct {
// contains filtered or unexported fields
}
func (*Merger) DisableFsync ¶
func (m *Merger) DisableFsync()
func (*Merger) FindMergeRanges ¶
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
func NoGaps ¶
func NoGaps[T SortedRange](in []T) (out []T, missingRanges []Range)
func SegmentsCaplin ¶
func TypedSegments ¶
type RoSnapshots ¶
type RoSnapshots struct {
// contains filtered or unexported fields
}
func NewRoSnapshots ¶
func NewRoSnapshots(cfg ethconfig.BlocksFreezing, snapDir string, types []snaptype.Type, segmentsMin uint64, alignMin bool, logger log.Logger) *RoSnapshots
NewRoSnapshots - opens all snapshots. But to simplify everything:
- it opens snapshots only on App start and immutable after
- all snapshots of given blocks range must exist - to make this blocks range available
- gaps are not allowed
- segment have [from:to) semantic
func (*RoSnapshots) AddSnapshotsToSilkworm ¶
func (s *RoSnapshots) AddSnapshotsToSilkworm(silkwormInstance *silkworm.Silkworm) error
func (*RoSnapshots) BlocksAvailable ¶
func (s *RoSnapshots) BlocksAvailable() uint64
func (*RoSnapshots) BuildMissedIndices ¶
func (*RoSnapshots) Cfg ¶
func (s *RoSnapshots) Cfg() ethconfig.BlocksFreezing
func (*RoSnapshots) Close ¶
func (s *RoSnapshots) Close()
func (*RoSnapshots) Delete ¶
func (s *RoSnapshots) Delete(fileName string) error
prune visible segments
func (*RoSnapshots) Dir ¶
func (s *RoSnapshots) Dir() string
func (*RoSnapshots) DirtyBlocksAvailable ¶
func (s *RoSnapshots) DirtyBlocksAvailable(t snaptype.Enum) uint64
func (*RoSnapshots) DisableReadAhead ¶
func (s *RoSnapshots) DisableReadAhead() *RoSnapshots
DisableReadAhead - usage: `defer d.EnableReadAhead().DisableReadAhead()`. Please don't use this funcs without `defer` to avoid leak.
func (*RoSnapshots) DownloadComplete ¶
func (s *RoSnapshots) DownloadComplete()
func (*RoSnapshots) DownloadReady ¶
func (s *RoSnapshots) DownloadReady() bool
func (*RoSnapshots) EnableMadvWillNeed ¶
func (s *RoSnapshots) EnableMadvWillNeed() *RoSnapshots
func (*RoSnapshots) EnableReadAhead ¶
func (s *RoSnapshots) EnableReadAhead() *RoSnapshots
func (*RoSnapshots) EnsureExpectedBlocksAreAvailable ¶
func (s *RoSnapshots) EnsureExpectedBlocksAreAvailable(cfg *snapcfg.Cfg) error
func (*RoSnapshots) Files ¶
func (s *RoSnapshots) Files() (list []string)
func (*RoSnapshots) IndexBuilder ¶
func (s *RoSnapshots) IndexBuilder(t snaptype.Type) snaptype.IndexBuilder
func (*RoSnapshots) IndicesMax ¶
func (s *RoSnapshots) IndicesMax() uint64
func (*RoSnapshots) InitSegments ¶
func (s *RoSnapshots) InitSegments(fileNames []string) error
func (*RoSnapshots) LogStat ¶
func (s *RoSnapshots) LogStat(label string)
func (*RoSnapshots) Ls ¶
func (s *RoSnapshots) Ls()
func (*RoSnapshots) OpenFiles ¶
func (s *RoSnapshots) OpenFiles() (list []string)
func (*RoSnapshots) OpenFolder ¶
func (s *RoSnapshots) OpenFolder() error
func (*RoSnapshots) OpenList ¶
func (s *RoSnapshots) OpenList(fileNames []string, optimistic bool) error
OpenList stops on optimistic=false, continue opening files on optimistic=true
func (*RoSnapshots) OpenSegments ¶
func (s *RoSnapshots) OpenSegments(types []snaptype.Type, allowGaps bool) error
func (*RoSnapshots) OptimisticalyOpenFolder ¶
func (s *RoSnapshots) OptimisticalyOpenFolder()
func (*RoSnapshots) PrintDebug ¶
func (s *RoSnapshots) PrintDebug()
func (*RoSnapshots) RangeExtractor ¶
func (s *RoSnapshots) RangeExtractor(t snaptype.Type) snaptype.RangeExtractor
func (*RoSnapshots) Ranges ¶
func (s *RoSnapshots) Ranges() []Range
func (*RoSnapshots) RemoveOldFiles ¶
func (s *RoSnapshots) RemoveOldFiles(filesToRemove []string)
func (*RoSnapshots) RemoveOverlaps ¶
func (s *RoSnapshots) RemoveOverlaps() error
func (*RoSnapshots) SegmentsMax ¶
func (s *RoSnapshots) SegmentsMax() uint64
func (*RoSnapshots) SegmentsMin ¶
func (s *RoSnapshots) SegmentsMin() uint64
func (*RoSnapshots) SegmentsReady ¶
func (s *RoSnapshots) SegmentsReady() bool
func (*RoSnapshots) SetIndexBuilder ¶
func (s *RoSnapshots) SetIndexBuilder(t snaptype.Type, indexBuilder snaptype.IndexBuilder)
func (*RoSnapshots) SetRangeExtractor ¶
func (s *RoSnapshots) SetRangeExtractor(t snaptype.Type, rangeExtractor snaptype.RangeExtractor)
func (*RoSnapshots) SetSegmentsMin ¶
func (s *RoSnapshots) SetSegmentsMin(min uint64)
func (*RoSnapshots) Types ¶
func (s *RoSnapshots) Types() []snaptype.Type
func (*RoSnapshots) View ¶
func (s *RoSnapshots) View() *View
func (*RoSnapshots) ViewSingleFile ¶
func (s *RoSnapshots) ViewSingleFile(t snaptype.Type, blockNum uint64) (segment *VisibleSegment, ok bool, close func())
func (*RoSnapshots) VisibleBlocksAvailable ¶
func (s *RoSnapshots) VisibleBlocksAvailable(t snaptype.Enum) uint64
type RoTx ¶
type RoTx struct {
Segments VisibleSegments
}
type SortedRange ¶
type VisibleSegment ¶
type VisibleSegment struct { Range // contains filtered or unexported fields }
func RecalcVisibleSegments ¶
func RecalcVisibleSegments(dirtySegments *btree.BTreeG[*DirtySegment]) []*VisibleSegment
func (*VisibleSegment) IsIndexed ¶
func (s *VisibleSegment) IsIndexed() bool
func (*VisibleSegment) Src ¶
func (s *VisibleSegment) Src() *DirtySegment
type VisibleSegments ¶
type VisibleSegments []*VisibleSegment
func (VisibleSegments) BeginRo ¶
func (s VisibleSegments) BeginRo() *RoTx
Click to show internal directories.
Click to hide internal directories.