service

package
v0.0.0-...-1fe6bf9 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package service provides the ctop service backend

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

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

connects to a single chain

func NewConnector

func NewConnector(ctx context.Context, network string, url string) (*Connector, error)

func (*Connector) Close

func (c *Connector) Close()

func (*Connector) GetNewRoundSteps

func (c *Connector) GetNewRoundSteps() <-chan types.EventDataRoundState

Returns a channel that can be used to retrieve NewRoundStep events

func (*Connector) GetNewRounds

func (c *Connector) GetNewRounds() <-chan types.EventDataNewRound

Returns a channel that can be used to retrieve NewRound events

func (*Connector) GetVotes

func (c *Connector) GetVotes() <-chan types.EventDataVote

Returns a channel that can be used to retrieve vote events

func (*Connector) Network

func (c *Connector) Network() string

Returns the network this connector is for

func (*Connector) Start

func (c *Connector) Start() error

Starts the connector event loop, which subscribes to Vote, NewRound, and NewRoundStep events

func (*Connector) Validators

func (c *Connector) Validators() ([]*types.Validator, error)

Returns all currently active validators for this network

type RedisEventStream

type RedisEventStream struct {
	CredClient *cred.CredClient
	Database   *db.Database
	// contains filtered or unexported fields
}

func NewRedisEventStream

func NewRedisEventStream(
	ctx context.Context,
	redisUrl string,
	unsafe bool,
	database *db.Database,
) (*RedisEventStream, error)

func (*RedisEventStream) PersistNewRoundEvents

func (rds *RedisEventStream) PersistNewRoundEvents(
	network string,
) error

func (*RedisEventStream) PersistNewRoundStepEvents

func (rds *RedisEventStream) PersistNewRoundStepEvents(
	network string,
) error

func (*RedisEventStream) PersistVoteEvents

func (rds *RedisEventStream) PersistVoteEvents(
	network string,
) error

func (*RedisEventStream) StreamRedisEvents

func (rds *RedisEventStream) StreamRedisEvents(
	network string,
	eventType cmtpubsub.Query,
	outCh chan interface{},
) error

streams events from redis, inserting into database

type Service

type Service struct {
	CredClient *cred.CredClient

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewService

func NewService(
	ctx context.Context,
	redisUrl string,
	unsafe bool,

	endpoints map[string]string,
) (*Service, error)

func (*Service) Close

func (s *Service) Close()

func (*Service) StartEventSubscriptions

func (s *Service) StartEventSubscriptions() error

starts all connectors and listens to incoming events

type ValidatorIndexer

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

Periodically indexes

func NewValidatorIndexer

func NewValidatorIndexer(
	ctx context.Context,
	db *db.Database,
	endpoints map[string]string,
) (*ValidatorIndexer, error)

func (*ValidatorIndexer) Start

func (vi *ValidatorIndexer) Start(
	pollFrequency time.Duration,
)

Jump to

Keyboard shortcuts

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