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.GetMostRecentDeHistorySegmentResponse, error)
- func InitialiseDatanodeFromDeHistory(parentCtx context.Context, cfg InitializationConfig, log *logging.Logger, ...) error
- func VerifyChainID(chainID string, chainService *service.Chain) error
- type BlockCommitHandler
- type Config
- type DeHistory
- type FetchResult
- type InitializationConfig
- type PeerResponse
- func GetMostRecentHistorySegmentFromPeersAddresses(ctx context.Context, peerAddresses []string, swarmKey string, ...) (*PeerResponse, map[string]*v2.GetMostRecentDeHistorySegmentResponse, error)
- func SelectMostRecentHistorySegmentResponse(peerToResponse map[string]*v2.GetMostRecentDeHistorySegmentResponse, ...) *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) GetHighestBlockHeightHistorySegment() (store.SegmentIndexEntry, error)
- func (d *Service) GetMostRecentHistorySegmentFromPeers(ctx context.Context, grpcAPIPorts []int) (*PeerResponse, map[string]*v2.GetMostRecentDeHistorySegmentResponse, error)
- func (d *Service) GetSwarmKey() string
- func (d *Service) ListAllHistorySegments() ([]store.SegmentIndexEntry, error)
- func (d *Service) LoadDeHistoryIntoDatanode(ctx context.Context) (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 ¶ added in v0.64.0
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 ¶ added in v0.64.0
func GetDatanodeClientFromIPAndPort(ip string, port int) (v2.TradingDataServiceClient, *grpc.ClientConn, error)
func GetMostRecentHistorySegmentFromPeer ¶ added in v0.64.0
func InitialiseDatanodeFromDeHistory ¶ added in v0.66.0
func InitialiseDatanodeFromDeHistory(parentCtx context.Context, cfg InitializationConfig, log *logging.Logger, deHistoryService DeHistory, currentSpan sqlstore.DatanodeBlockSpan, grpcPorts []int, ) error
Types ¶
type BlockCommitHandler ¶ added in v0.63.0
type BlockCommitHandler struct {
// contains filtered or unexported fields
}
func NewBlockCommitHandler ¶ added in v0.63.0
func (*BlockCommitHandler) OnBlockCommitted ¶ added in v0.63.0
type Config ¶
type Config struct { Level encoding.LogLevel `long:"log-level"` Enabled encoding.Bool `long:"enabled" description:"set to false to disable decentralized history"` WipeOnStartup encoding.Bool `long:"wipe-on-startup" description:"remove all deHistory state on startup"` Publish encoding.Bool `long:"publish" description:"if true this node will create and publish decentralized 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 DeHistory ¶ added in v0.64.0
type DeHistory interface { FetchHistorySegment(ctx context.Context, historySegmentID string) (store.SegmentIndexEntry, error) LoadDeHistoryIntoDatanode(ctx context.Context) (snapshot.LoadResult, error) GetMostRecentHistorySegmentFromPeers(ctx context.Context, grpcAPIPorts []int) (*PeerResponse, map[string]*v2.GetMostRecentDeHistorySegmentResponse, error) }
type FetchResult ¶ added in v0.64.0
func FromSegmentIndexEntry ¶ added in v0.64.0
func FromSegmentIndexEntry(s store.SegmentIndexEntry) FetchResult
type InitializationConfig ¶ added in v0.64.0
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 ¶ added in v0.64.0
func NewDefaultInitializationConfig() InitializationConfig
type PeerResponse ¶ added in v0.65.0
type PeerResponse struct { PeerAddr string Response *v2.GetMostRecentDeHistorySegmentResponse }
func GetMostRecentHistorySegmentFromPeersAddresses ¶ added in v0.65.0
func GetMostRecentHistorySegmentFromPeersAddresses(ctx context.Context, peerAddresses []string, swarmKey string, grpcAPIPorts []int, ) (*PeerResponse, map[string]*v2.GetMostRecentDeHistorySegmentResponse, error)
func SelectMostRecentHistorySegmentResponse ¶ added in v0.65.0
func SelectMostRecentHistorySegmentResponse(peerToResponse map[string]*v2.GetMostRecentDeHistorySegmentResponse, swarmKey string) *PeerResponse
TODO this needs some thought as to the best strategy to select the response to avoid spoofing.
type ProtocolUpgradeHandler ¶ added in v0.63.0
type ProtocolUpgradeHandler struct {
// contains filtered or unexported fields
}
func NewProtocolUpgradeHandler ¶ added in v0.63.0
func NewProtocolUpgradeHandler( log *logging.Logger, protocolUpgradeService *service.ProtocolUpgrade, eventSender eventSender, createAndPublishSegment func(ctx context.Context, chainID string, toHeight int64) error, ) *ProtocolUpgradeHandler
func (*ProtocolUpgradeHandler) GetProtocolUpgradeStarted ¶ added in v0.63.0
func (t *ProtocolUpgradeHandler) GetProtocolUpgradeStarted() bool
func (*ProtocolUpgradeHandler) OnProtocolUpgradeEvent ¶ added in v0.63.0
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewWithStore ¶
func (*Service) CopyHistorySegmentToFile ¶ added in v0.62.0
func (*Service) CreateAndPublishSegment ¶ added in v0.63.0
func (*Service) FetchHistorySegment ¶
func (*Service) GetActivePeerAddresses ¶
func (*Service) GetContiguousHistoryFromHighestHeight ¶ added in v0.66.0
func (d *Service) GetContiguousHistoryFromHighestHeight() ([]aggregation.AggregatedHistorySegment, error)
GetContiguousHistoryFromHighestHeight returns all available contiguous (no gaps) history from the highest height.
func (*Service) GetHighestBlockHeightHistorySegment ¶
func (d *Service) GetHighestBlockHeightHistorySegment() (store.SegmentIndexEntry, error)
func (*Service) GetMostRecentHistorySegmentFromPeers ¶ added in v0.64.0
func (d *Service) GetMostRecentHistorySegmentFromPeers(ctx context.Context, grpcAPIPorts []int, ) (*PeerResponse, map[string]*v2.GetMostRecentDeHistorySegmentResponse, error)
func (*Service) GetSwarmKey ¶ added in v0.65.0
func (*Service) ListAllHistorySegments ¶
func (d *Service) ListAllHistorySegments() ([]store.SegmentIndexEntry, error)
func (*Service) LoadDeHistoryIntoDatanode ¶ added in v0.66.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.