Documentation
¶
Index ¶
- Variables
- func MultihashFromHexString(s string) (mh.Multihash, error)
- type Block
- type BlockAppLookup
- type BlockAppLookupIndex
- type BlockConsumer
- type BlockExtension
- type BlockNotification
- type BlockOption
- type BlockRequester
- type BlockTracker
- type CallBackConsumer
- type ConsumerType
- type NetworkScrapper
- func (s *NetworkScrapper) Close(ctx context.Context) error
- func (s *NetworkScrapper) GetQuorum() int
- func (s *NetworkScrapper) GetSamplingItemStream() chan []*models.SamplingItem
- func (s *NetworkScrapper) Serve(ctx context.Context) error
- func (s *NetworkScrapper) SyncWithDatabase(ctx context.Context) ([]*models.SamplingItem, error)
- type TextConsumer
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultBlockTracker = &config.AvailBlockTrackerConfig{ Network: config.DefaultAvailNetwork.String(), AvailAPIconfig: api.DefaultClientConfig, Meter: otel.GetMeterProvider().Meter("avail_block_tracker"), }
View Source
var DefaultNetorkScrapperConfig = &config.AvailNetworkScrapperConfig{ Network: config.DefaultAvailNetwork.String(), TrackBlocksOnDB: true, NotChannelBufferSize: 1000, SamplerNotifyTimeout: 10 * time.Second, TrackDuration: 20 * time.Minute, TrackInterval: 6 * time.Hour, BlockTrackerCfg: DefaultBlockTracker, }
Functions ¶
Types ¶
type Block ¶
type Block struct {
ReceivedAt int64
Hash mh.Multihash
ParentHash mh.Multihash
Number uint64
StateRoot mh.Multihash
ExtrinsicsRoot mh.Multihash
Extension BlockExtension
}
func NewBlock ¶
func NewBlock(opts ...BlockOption) (*Block, error)
func (*Block) GetDASSamplingItems ¶
func (*Block) SampleUntil ¶
func (*Block) UTCTimestamp ¶
type BlockAppLookup ¶
type BlockAppLookup struct {
Size uint64
Index []BlockAppLookupIndex
}
type BlockAppLookupIndex ¶
type BlockConsumer ¶
type BlockConsumer interface {
Type() ConsumerType
Serve(context.Context) error
ProccessNewBlock(context.Context, *BlockNotification, time.Time) error
}
type BlockExtension ¶
type BlockNotification ¶
type BlockNotification struct {
RequestTime time.Time
BlockInfo api.V2BlockHeader
}
type BlockOption ¶
func FromAPIBlockHeader ¶
func FromAPIBlockHeader(blockHeader api.V2BlockHeader) BlockOption
type BlockRequester ¶
type BlockRequester struct {
// contains filtered or unexported fields
}
func NewBlockRequester ¶
func NewBlockRequester( apiCli *api.HTTPClient, networkConfig *config.NetworkConfiguration, consumers []BlockConsumer) (*BlockRequester, error)
func (*BlockRequester) AvailAPIhealthcheck ¶
func (r *BlockRequester) AvailAPIhealthcheck(ctx context.Context) error
type BlockTracker ¶
type BlockTracker struct {
BlockRequester *BlockRequester
// contains filtered or unexported fields
}
func NewBlockTracker ¶
func NewBlockTracker( ctx context.Context, cfg *config.AvailBlockTrackerConfig, blockConsumers ...BlockConsumer) (*BlockTracker, error)
type CallBackConsumer ¶
type CallBackConsumer struct {
// contains filtered or unexported fields
}
func NewCallBackConsumer ¶
func NewCallBackConsumer( ctx context.Context, blockProcessFn func(context.Context, *BlockNotification, time.Time) error, ) (*CallBackConsumer, error)
func (*CallBackConsumer) ProccessNewBlock ¶
func (cb *CallBackConsumer) ProccessNewBlock( ctx context.Context, blockNot *BlockNotification, lastReqT time.Time) error
func (*CallBackConsumer) Type ¶
func (cb *CallBackConsumer) Type() ConsumerType
type ConsumerType ¶
type ConsumerType string
var ( TextConsumerType ConsumerType = "text" AkaiAPIConsumerType ConsumerType = "akai_api" CallBackConsumerType ConsumerType = "callback" )
type NetworkScrapper ¶
type NetworkScrapper struct {
// contains filtered or unexported fields
}
NetworkScrapper is a minor wrapper on top of the BlockTracker that takes care of: - keeping track of all the DAS items comming from the Avail network - populate the DB with block information - perform some catching to not spam the DataSampler - notify to the DataSampler whenever there is an new item to track
func NewNetworkScrapper ¶
func NewNetworkScrapper( cfg *config.AvailNetworkScrapperConfig, db db.Database, ) (*NetworkScrapper, error)
func (*NetworkScrapper) GetQuorum ¶
func (s *NetworkScrapper) GetQuorum() int
func (*NetworkScrapper) GetSamplingItemStream ¶
func (s *NetworkScrapper) GetSamplingItemStream() chan []*models.SamplingItem
func (*NetworkScrapper) SyncWithDatabase ¶
func (s *NetworkScrapper) SyncWithDatabase(ctx context.Context) ([]*models.SamplingItem, error)
syncs up with the database any prior existing sampleable item that we should keep tracking
type TextConsumer ¶
type TextConsumer struct{}
TextConsumer (most simple text logger consumer)
func NewTextConsumer ¶
func NewTextConsumer() (*TextConsumer, error)
func (*TextConsumer) ProccessNewBlock ¶
func (tc *TextConsumer) ProccessNewBlock( ctx context.Context, blockNot *BlockNotification, lastReqT time.Time) error
func (*TextConsumer) Type ¶
func (tc *TextConsumer) Type() ConsumerType
Source Files
¶
Click to show internal directories.
Click to hide internal directories.