segment

package
v0.78.5 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	HeightFrom      int64
	HeightTo        int64
	DatabaseVersion int64
	ChainID         string
}

Base is the base struct for all segment types.

func NewFromSnapshotDataDirectory added in v0.74.0

func NewFromSnapshotDataDirectory(dirName string) (Base, error)

func (Base) GetChainId

func (m Base) GetChainId() string

func (Base) GetDatabaseVersion

func (m Base) GetDatabaseVersion() int64

func (Base) GetFromHeight

func (m Base) GetFromHeight() int64

func (Base) GetToHeight

func (m Base) GetToHeight() int64

func (Base) SnapshotDataDirectory added in v0.74.0

func (m Base) SnapshotDataDirectory() string

func (Base) String

func (m Base) String() string

func (Base) ZipFileName

func (m Base) ZipFileName() string

type ContiguousHistory

type ContiguousHistory[T blockSpanner] struct {
	HeightFrom int64
	HeightTo   int64
	Segments   []T
}

ContiguousHistory is a list of ordered contiguous segments.

func NewChunkFromSegment

func NewChunkFromSegment[T blockSpanner](segment T) ContiguousHistory[T]

NewChunkFromSegment returns a chunk containing a single segment.

func (*ContiguousHistory[T]) Add

func (c *ContiguousHistory[T]) Add(new T) bool

Add attempts to insert new segment to the chunk, either at the beginning or at the end. It returns true if the segment was added, false if the new segment doesn't lead or follow our current range.

func (ContiguousHistory[T]) Slice

func (c ContiguousHistory[T]) Slice(from int64, to int64) ContiguousHistory[T]

Slice returns a new chunk containing the segments which partially or fully fall into the specified range.

type Full

type Full struct {
	MetaData
	HistorySegmentID string
}

Full is a segment that has been added to the store and has been assigned a segment ID.

func (Full) GetHistorySegmentId

func (f Full) GetHistorySegmentId() string

type MetaData

type MetaData struct {
	Base
	PreviousHistorySegmentID string
}

MetaData adds a PreviousHistorySegmentID, and is the struct that gets serialized into the JSON metadata when a segment is added to the store.

func (MetaData) GetPreviousHistorySegmentId

func (m MetaData) GetPreviousHistorySegmentId() string

type Segments

type Segments[T blockSpanner] []T

Segments is just a list of segments with a bit of syntactic sugar for getting contiguous histories of segments in a nice way.

func (Segments[T]) AllContigousHistories

func (s Segments[T]) AllContigousHistories() []ContiguousHistory[T]

func (Segments[T]) ContiguousHistoryInRange

func (s Segments[T]) ContiguousHistoryInRange(fromHeight int64, toHeight int64) (ContiguousHistory[T], error)

func (Segments[T]) MostRecentContiguousHistory

func (s Segments[T]) MostRecentContiguousHistory() (ContiguousHistory[T], error)

type Staged

type Staged struct {
	Full
	Directory string
}

Staged is a segment which has been added to the store and then fetched back again.

func (Staged) ZipFilePath

func (s Staged) ZipFilePath() string

type Unpublished

type Unpublished struct {
	Base
	Directory string
}

Unpublished is a segment that has just been dumped from the database into a zip file but hasn't yet been added to the store so doesn't have any extra metadata.

func (Unpublished) InProgressFilePath

func (s Unpublished) InProgressFilePath() string

func (Unpublished) UnpublishedSnapshotDataDirectory added in v0.74.0

func (s Unpublished) UnpublishedSnapshotDataDirectory() string

Jump to

Keyboard shortcuts

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