Documentation ¶
Index ¶
- Variables
- func FetchHistoryBlocks(ctx context.Context, logInfo func(s string, args ...interface{}), ...) (int64, error)
- func GetDatanodeClientFromIPAndPort(ip string, port int) (v2.TradingDataServiceClient, *grpc.ClientConn, error)
- func GetMostRecentHistorySegmentFromPeer(ctx context.Context, ip string, datanodeGrpcAPIPort int) (*v2.GetMostRecentNetworkHistorySegmentResponse, error)
- func InitialiseDatanodeFromNetworkHistory(parentCtx context.Context, cfg InitializationConfig, log *logging.Logger, ...) error
- func KillAllConnectionsToDatabase(ctx context.Context, connConfig sqlstore.ConnectionConfig) error
- func VerifyChainID(chainID string, chainService *service.Chain) error
- type BlockCommitHandler
- type Config
- type FetchResult
- type InitializationConfig
- type NetworkHistory
- type PeerResponse
- func GetMostRecentHistorySegmentFromPeersAddresses(ctx context.Context, peerAddresses []string, swarmKeySeed string, ...) (*PeerResponse, map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, ...)
- func SelectMostRecentHistorySegmentResponse(peerToResponse map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, ...) *PeerResponse
- type ProtocolUpgradeHandler
- type Service
- func (d *Service) CopyHistorySegmentToFile(ctx context.Context, historySegmentID string, outFile string) error
- func (d *Service) CreateAndPublishSegment(ctx context.Context, chainID string, toHeight int64) error
- func (d *Service) FetchHistorySegment(parentCtx context.Context, historySegmentID string) (segment.Full, error)
- func (d *Service) GetActivePeerIPAddresses() []string
- func (d *Service) GetBootstrapPeers() []string
- func (d *Service) GetConnectedPeerAddresses() ([]string, error)
- func (d *Service) GetDatanodeBlockSpan(ctx context.Context) (sqlstore.DatanodeBlockSpan, error)
- func (d *Service) GetHighestBlockHeightHistorySegment() (segment.Full, error)
- func (d *Service) GetHistorySegmentReader(ctx context.Context, historySegmentID string) (io.ReadSeekCloser, int64, error)
- func (d *Service) GetIpfsAddress() (string, error)
- func (d *Service) GetMostRecentHistorySegmentFromPeers(ctx context.Context, grpcAPIPorts []int) (*PeerResponse, map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, ...)
- func (d *Service) GetSwarmKey() string
- func (d *Service) GetSwarmKeySeed() string
- func (d *Service) ListAllHistorySegments() (segment.Segments[segment.Full], error)
- func (d *Service) LoadNetworkHistoryIntoDatanode(ctx context.Context, chunk segment.ContiguousHistory[segment.Full], ...) (snapshot.LoadResult, error)
- func (d *Service) LoadNetworkHistoryIntoDatanodeWithLog(ctx context.Context, log snapshot.LoadLog, ...) (snapshot.LoadResult, error)
- func (d *Service) PublishSegments(ctx context.Context) error
- func (d *Service) RollbackToHeight(ctx context.Context, log snapshot.LoadLog, height int64) error
- func (d *Service) Stop()
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrChainNotFound = errors.New("no chain found")
Functions ¶
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 GetDatanodeClientFromIPAndPort ¶
func GetDatanodeClientFromIPAndPort(ip string, port int) (v2.TradingDataServiceClient, *grpc.ClientConn, error)
func InitialiseDatanodeFromNetworkHistory ¶
func InitialiseDatanodeFromNetworkHistory(parentCtx context.Context, cfg InitializationConfig, log *logging.Logger, connCfg sqlstore.ConnectionConfig, networkHistoryService NetworkHistory, grpcPorts []int, verboseMigration bool, ) error
func KillAllConnectionsToDatabase ¶
func KillAllConnectionsToDatabase(ctx context.Context, connConfig sqlstore.ConnectionConfig) error
Types ¶
type BlockCommitHandler ¶
type BlockCommitHandler struct {
// contains filtered or unexported fields
}
func NewBlockCommitHandler ¶
func (*BlockCommitHandler) OnBlockCommitted ¶
type Config ¶
type Config struct { Level encoding.LogLevel `long:"log-level"` Enabled encoding.Bool `description:"set to false to disable network history" long:"enabled"` WipeOnStartup encoding.Bool `description:"deprecated and ignored, use data-node unsafe_reset_all command instead" long:"wipe-on-startup"` Publish encoding.Bool `description:"if true this node will create and publish network history segments" long:"publish"` Store store.Config `group:"Store" namespace:"store"` Snapshot snapshot.Config `group:"Snapshot" namespace:"snapshot"` FetchRetryMax int `description:"maximum number of times to retry fetching segments - default 10" long:"fetch-retry-max"` RetryTimeout encoding.Duration `description:"time to wait between retries, increases with each retry - default 5s" long:"retry-timeout"` Initialise InitializationConfig `group:"Initialise" namespace:"initialise"` }
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.
type FetchResult ¶
func FromSegmentIndexEntry ¶
func FromSegmentIndexEntry(s segment.Full) FetchResult
type InitializationConfig ¶
type InitializationConfig struct { ToSegment string `` /* 146-byte string literal not displayed */ MinimumBlockCount int64 `` /* 147-byte string literal not displayed */ TimeOut encoding.Duration `` /* 143-byte string literal not displayed */ GrpcAPIPorts []int `` /* 150-byte string literal not displayed */ }
func NewDefaultInitializationConfig ¶
func NewDefaultInitializationConfig() InitializationConfig
type NetworkHistory ¶
type NetworkHistory interface { FetchHistorySegment(ctx context.Context, historySegmentID string) (segment.Full, error) LoadNetworkHistoryIntoDatanode(ctx context.Context, chunk segment.ContiguousHistory[segment.Full], cfg sqlstore.ConnectionConfig, withIndexesAndOrderTriggers, verbose bool) (snapshot.LoadResult, error) GetMostRecentHistorySegmentFromPeers(ctx context.Context, grpcAPIPorts []int) (*PeerResponse, map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, error) GetDatanodeBlockSpan(ctx context.Context) (sqlstore.DatanodeBlockSpan, error) ListAllHistorySegments() (segment.Segments[segment.Full], error) }
it would be nice to use go:generate go run github.com/golang/mock/mockgen -destination mocks/networkhistory_service_mock.go -package mocks code.vegaprotocol.io/vega/datanode/networkhistory NetworkHistory but it messes up with generic interfaces and so requires a bit of manual fiddling.
type PeerResponse ¶
type PeerResponse struct { PeerAddr string Response *v2.GetMostRecentNetworkHistorySegmentResponse }
func GetMostRecentHistorySegmentFromPeersAddresses ¶
func GetMostRecentHistorySegmentFromPeersAddresses(ctx context.Context, peerAddresses []string, swarmKeySeed string, grpcAPIPorts []int, ) (*PeerResponse, map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, error)
func SelectMostRecentHistorySegmentResponse ¶
func SelectMostRecentHistorySegmentResponse(peerToResponse map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, swarmKeySeed string) *PeerResponse
TODO this needs some thought as to the best strategy to select the response to avoid spoofing.
type ProtocolUpgradeHandler ¶
type ProtocolUpgradeHandler struct {
// contains filtered or unexported fields
}
func NewProtocolUpgradeHandler ¶
func NewProtocolUpgradeHandler( log *logging.Logger, protocolUpgradeService *service.ProtocolUpgrade, eventSender eventSender, createAndPublishSegment func(ctx context.Context, chainID string, toHeight int64) error, ) *ProtocolUpgradeHandler
func (*ProtocolUpgradeHandler) GetProtocolUpgradeStarted ¶
func (t *ProtocolUpgradeHandler) GetProtocolUpgradeStarted() bool
func (*ProtocolUpgradeHandler) OnProtocolUpgradeEvent ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewWithStore ¶
func (*Service) CopyHistorySegmentToFile ¶
func (*Service) CreateAndPublishSegment ¶
func (*Service) FetchHistorySegment ¶
func (*Service) GetActivePeerIPAddresses ¶ added in v0.68.0
func (*Service) GetBootstrapPeers ¶ added in v0.68.0
func (*Service) GetConnectedPeerAddresses ¶ added in v0.68.0
func (*Service) GetDatanodeBlockSpan ¶
func (*Service) GetHighestBlockHeightHistorySegment ¶
func (*Service) GetHistorySegmentReader ¶ added in v0.71.0
func (*Service) GetIpfsAddress ¶ added in v0.68.0
func (*Service) GetMostRecentHistorySegmentFromPeers ¶
func (d *Service) GetMostRecentHistorySegmentFromPeers(ctx context.Context, grpcAPIPorts []int, ) (*PeerResponse, map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, error)
func (*Service) GetSwarmKey ¶
func (*Service) GetSwarmKeySeed ¶ added in v0.68.0
func (*Service) ListAllHistorySegments ¶
func (*Service) LoadNetworkHistoryIntoDatanode ¶
func (d *Service) LoadNetworkHistoryIntoDatanode(ctx context.Context, chunk segment.ContiguousHistory[segment.Full], connConfig sqlstore.ConnectionConfig, withIndexesAndOrderTriggers, verbose bool, ) (snapshot.LoadResult, error)
func (*Service) LoadNetworkHistoryIntoDatanodeWithLog ¶ added in v0.68.0
func (d *Service) LoadNetworkHistoryIntoDatanodeWithLog(ctx context.Context, log snapshot.LoadLog, chunk segment.ContiguousHistory[segment.Full], connConfig sqlstore.ConnectionConfig, withIndexesAndOrderTriggers, verbose bool, ) (snapshot.LoadResult, error)
func (*Service) PublishSegments ¶ added in v0.72.0
func (*Service) RollbackToHeight ¶ added in v0.71.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.