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, swarmKey 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(ctx context.Context, historySegmentID string) (store.SegmentIndexEntry, error)
- func (d *Service) GetActivePeerAddresses() []string
- func (d *Service) GetContiguousHistoryFromHighestHeight() ([]aggregation.AggregatedHistorySegment, error)
- func (d *Service) GetDatanodeBlockSpan(ctx context.Context) (sqlstore.DatanodeBlockSpan, error)
- func (d *Service) GetHighestBlockHeightHistorySegment() (store.SegmentIndexEntry, error)
- func (d *Service) GetMostRecentHistorySegmentFromPeers(ctx context.Context, grpcAPIPorts []int) (*PeerResponse, map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, ...)
- func (d *Service) GetSwarmKey() string
- func (d *Service) ListAllHistorySegments() ([]store.SegmentIndexEntry, error)
- func (d *Service) LoadNetworkHistoryIntoDatanode(ctx context.Context, connConfig sqlstore.ConnectionConfig) (snapshot.LoadResult, 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, ) 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 `long:"enabled" description:"set to false to disable network history"` WipeOnStartup encoding.Bool `long:"wipe-on-startup" description:"remove all network history state on startup"` Publish encoding.Bool `long:"publish" description:"if true this node will create and publish network history segments"` Store store.Config `group:"Store" namespace:"store"` Snapshot snapshot.Config `group:"Snapshot" namespace:"snapshot"` 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 store.SegmentIndexEntry) FetchResult
type InitializationConfig ¶
type InitializationConfig struct { ToSegment string `` /* 146-byte string literal not displayed */ 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"` GrpcAPIPorts []int `long:"grpc-api-ports" description:"list of additional ports to check to for api connection when getting latest segment"` }
func NewDefaultInitializationConfig ¶
func NewDefaultInitializationConfig() InitializationConfig
type NetworkHistory ¶
type NetworkHistory interface { FetchHistorySegment(ctx context.Context, historySegmentID string) (store.SegmentIndexEntry, error) LoadNetworkHistoryIntoDatanode(ctx context.Context, cfg sqlstore.ConnectionConfig) (snapshot.LoadResult, error) GetMostRecentHistorySegmentFromPeers(ctx context.Context, grpcAPIPorts []int) (*PeerResponse, map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, error) GetDatanodeBlockSpan(ctx context.Context) (sqlstore.DatanodeBlockSpan, error) }
type PeerResponse ¶
type PeerResponse struct { PeerAddr string Response *v2.GetMostRecentNetworkHistorySegmentResponse }
func GetMostRecentHistorySegmentFromPeersAddresses ¶
func GetMostRecentHistorySegmentFromPeersAddresses(ctx context.Context, peerAddresses []string, swarmKey string, grpcAPIPorts []int, ) (*PeerResponse, map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, error)
func SelectMostRecentHistorySegmentResponse ¶
func SelectMostRecentHistorySegmentResponse(peerToResponse map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, swarmKey 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) GetActivePeerAddresses ¶
func (*Service) GetContiguousHistoryFromHighestHeight ¶
func (d *Service) GetContiguousHistoryFromHighestHeight() ([]aggregation.AggregatedHistorySegment, error)
GetContiguousHistoryFromHighestHeight returns all available contiguous (no gaps) history from the highest height.
func (*Service) GetDatanodeBlockSpan ¶
func (*Service) GetHighestBlockHeightHistorySegment ¶
func (d *Service) GetHighestBlockHeightHistorySegment() (store.SegmentIndexEntry, error)
func (*Service) GetMostRecentHistorySegmentFromPeers ¶
func (d *Service) GetMostRecentHistorySegmentFromPeers(ctx context.Context, grpcAPIPorts []int, ) (*PeerResponse, map[string]*v2.GetMostRecentNetworkHistorySegmentResponse, error)
func (*Service) GetSwarmKey ¶
func (*Service) ListAllHistorySegments ¶
func (d *Service) ListAllHistorySegments() ([]store.SegmentIndexEntry, error)
func (*Service) LoadNetworkHistoryIntoDatanode ¶
func (d *Service) LoadNetworkHistoryIntoDatanode(ctx context.Context, connConfig sqlstore.ConnectionConfig) (snapshot.LoadResult, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.