collector

package
v0.2.8-beta.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package collector implements event collecting from pubsub

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB added in v0.1.11

type DB interface {
	StoreBlock(event *events.NewBlock) error
	StoreBlockValid(event *events.ValidBlock) error
	StoreTx(event *events.NewTx) error
	StoreTxValid(event *events.ValidTx) error
	StoreAtx(event *events.NewAtx) error
	StoreAtxValid(event *events.ValidAtx) error
	StoreReward(event *events.RewardReceived) error
	StoreBlockCreated(event *events.DoneCreatingBlock) error
	StoreAtxCreated(event *events.AtxCreated) error
	StoreTortoiseBeaconCalculated(event *events.TortoiseBeaconCalculated) error
}

DB defines which events should be stores by any db that the collector uses.

type Event

type Event interface {
	GetChannel() events.ChannelID
}

Event defines global interface for all events to help identify their types, which is channel id.

type EventsCollector added in v0.1.11

type EventsCollector struct {
	// contains filtered or unexported fields
}

EventsCollector collects events from node and writes them to DB.

func NewCollector

func NewCollector(db DB, url string) *EventsCollector

NewCollector created a new instance of the collector listening on url for events and writing them to the provided DB.

func (*EventsCollector) Start added in v0.1.11

func (c *EventsCollector) Start(blocking bool)

Start starts collecting events.

func (*EventsCollector) Stop added in v0.1.11

func (c *EventsCollector) Stop()

Stop stops collecting events.

type MemoryCollector

type MemoryCollector struct {
	Atxs map[string]uint32
	// contains filtered or unexported fields
}

MemoryCollector is an in memory database to store collected events.

func NewMemoryCollector

func NewMemoryCollector() *MemoryCollector

NewMemoryCollector initializes a new memory collector that stores collected events.

func (*MemoryCollector) AtxIDExists added in v0.1.28

func (c *MemoryCollector) AtxIDExists(atxID string) bool

AtxIDExists checks if an ATX with a certain ID exists.

func (*MemoryCollector) GetAtxCreationDone

func (c *MemoryCollector) GetAtxCreationDone(epoch types.EpochID) int

GetAtxCreationDone get number of atxs that were crated by this miner events for the provided epoch.

func (*MemoryCollector) GetBlockCreationDone

func (c *MemoryCollector) GetBlockCreationDone(layer types.LayerID) int

GetBlockCreationDone returns number of blocks created events for the given layer.

func (*MemoryCollector) GetCreatedAtx

func (c *MemoryCollector) GetCreatedAtx(epoch types.EpochID) []string

GetCreatedAtx returns the number of created atx events received for the epoch.

func (*MemoryCollector) GetNumOfCreatedATXs

func (c *MemoryCollector) GetNumOfCreatedATXs(layer types.LayerID) int

GetNumOfCreatedATXs returns numbe of created atxs per layer.

func (*MemoryCollector) GetNumOfCreatedBlocks

func (c *MemoryCollector) GetNumOfCreatedBlocks(layer types.LayerID) int

GetNumOfCreatedBlocks returns number of blocks created events received by this miner.

func (*MemoryCollector) GetReceivedATXsNum

func (c *MemoryCollector) GetReceivedATXsNum(layer types.LayerID) int

GetReceivedATXsNum returns the number of atx received events received for the provided layer.

func (*MemoryCollector) GetReceivedBlocks

func (c *MemoryCollector) GetReceivedBlocks(layer types.LayerID) int

GetReceivedBlocks returns number of blocks received events received by this miner.

func (*MemoryCollector) GetTortoiseBeacon

func (c *MemoryCollector) GetTortoiseBeacon(epoch types.EpochID) []string

GetTortoiseBeacon returns a list of tortoise beacons for a given epoch.

func (*MemoryCollector) StoreAtx

func (c *MemoryCollector) StoreAtx(event *events.NewAtx) error

StoreAtx stores created ATX by epoch.

func (*MemoryCollector) StoreAtxCreated

func (c *MemoryCollector) StoreAtxCreated(event *events.AtxCreated) error

StoreAtxCreated stores atx created events received by epoch.

func (*MemoryCollector) StoreAtxValid

func (c *MemoryCollector) StoreAtxValid(event *events.ValidAtx) error

StoreAtxValid stores an atx valididty event. not used thus commented out.

func (*MemoryCollector) StoreBlock

func (c *MemoryCollector) StoreBlock(event *events.NewBlock) error

StoreBlock stores block received event by layer id.

func (*MemoryCollector) StoreBlockCreated

func (c *MemoryCollector) StoreBlockCreated(event *events.DoneCreatingBlock) error

StoreBlockCreated stores block created events by layer.

func (*MemoryCollector) StoreBlockValid

func (c *MemoryCollector) StoreBlockValid(event *events.ValidBlock) error

StoreBlockValid stores block validity event.

func (*MemoryCollector) StoreReward

func (c *MemoryCollector) StoreReward(event *events.RewardReceived) error

StoreReward should store reward received but for now is is commented out since not used.

func (*MemoryCollector) StoreTortoiseBeaconCalculated

func (c *MemoryCollector) StoreTortoiseBeaconCalculated(event *events.TortoiseBeaconCalculated) error

StoreTortoiseBeaconCalculated stores tortoise beacon calculated events received by epoch.

func (*MemoryCollector) StoreTx

func (c *MemoryCollector) StoreTx(event *events.NewTx) error

StoreTx stores tx received event, currently commented out because not used.

func (*MemoryCollector) StoreTxValid

func (c *MemoryCollector) StoreTxValid(event *events.ValidTx) error

StoreTxValid stored tx validity event. currently commented out because not used.

Jump to

Keyboard shortcuts

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