initialise

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFailedToGetSegment = errors.New("no history segment found")

Functions

func DataNodeHasData

func DataNodeHasData(ctx context.Context, conf sqlstore.ConnectionConfig) (bool, error)

func DataNodeIsEmpty

func DataNodeIsEmpty(ctx context.Context, connConfig sqlstore.ConnectionConfig) (bool, error)

func DatanodeFromDeHistory

func DatanodeFromDeHistory(parentCtx context.Context, cfg Config, log *logging.Logger,
	deHistoryService deHistoryService, grpcAPIPort int,
) (err error)

func FetchHistoryBlocks

func FetchHistoryBlocks(ctx context.Context, logInfo func(s string, args ...interface{}), historySegmentID string,
	fetchHistory func(ctx context.Context, historySegmentID string) (FetchResult, error),
	numBlocksToFetch int64,
) (int64, error)

FetchHistoryBlocks will keep fetching history until numBlocksToFetch is reached or all history is retrieved.

func GetDatanodeBlockSpan

func GetDatanodeBlockSpan(ctx context.Context, connConfig sqlstore.ConnectionConfig) (from int64, to int64, err error)

func GetDatanodeClientFromIPAndPort

func GetDatanodeClientFromIPAndPort(ip string, port int) (v2.TradingDataServiceClient, *grpc.ClientConn, error)

func GetMostRecentHistorySegmentFromPeer

func GetMostRecentHistorySegmentFromPeer(ctx context.Context, ip string, datanodeGrpcAPIPort int) (*v2.HistorySegment, error)

func GetMostRecentHistorySegmentFromPeers

func GetMostRecentHistorySegmentFromPeers(ctx context.Context, peerAddresses []string,
	grpcAPIPort int,
) (*v2.HistorySegment, map[string]*v2.HistorySegment, error)

func GetOldestHistoryBlockAndLastBlock

func GetOldestHistoryBlockAndLastBlock(ctx context.Context, connConfig sqlstore.ConnectionConfig) (oldestHistoryBlock *entities.Block, lastBlock *entities.Block, err error)

func GetSnapshotPaths

func GetSnapshotPaths(useEmbedded bool, conf snapshot.Config, vegaPaths paths.Paths) (snapshotsCopyFrom string, snapshotsCopyTo string)

func HasVegaSchema

func HasVegaSchema(ctx context.Context, conf sqlstore.ConnectionConfig) (bool, error)

func SelectRootSegment

func SelectRootSegment(peerToSegment map[string]*v2.HistorySegment) *v2.HistorySegment

TODO this needs some thought as to the best strategy to select the root segment to avoid spoofing.

func VerifyChainID

func VerifyChainID(chainID string, chainService *service.Chain) error

Types

type Config

type Config struct {
	MinimumBlockCount int64             `long:"block-count" description:"the minimum number of blocks to fetch"`
	TimeOut           encoding.Duration `long:"timeout" description:"maximum time allowed to auto-initialise the node"`
}

func NewDefaultConfig

func NewDefaultConfig() Config

type FetchResult

type FetchResult struct {
	HeightFrom               int64
	HeightTo                 int64
	PreviousHistorySegmentID string
}

func FromSegmentIndexEntry

func FromSegmentIndexEntry(s store.SegmentIndexEntry) FetchResult

Jump to

Keyboard shortcuts

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