Help us shape the future of Go! Take the 2026 Go Developer Survey

sentinel

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: MIT Imports: 11 Imported by: 0

README

Sentinel

Sentinel is a centralized orchestrator that manages multiple blockchain poller services, each responsible for a specific blockchain network (e.g., Ethereum, Polygon, Arbitrum). It provides a unified interface for subscribing to blockchain events, ensuring efficient log polling and event broadcasting to subscribers.

Documentation

Documentation

Overview

File: helper.go

File: log.go

File: sentinel.go

File: sentinel_coordinator.go

Index

Constants

View Source
const (
	LogLevelEnvVar = "SENTINEL_LOG_LEVEL"
)

Variables

This section is empty.

Functions

func ConvertAPILogToTypesLog

func ConvertAPILogToTypesLog(log api.Log) (*types.Log, error)

ConvertAPILogToTypesLog maps an api.Log to a types.Log. Returns a pointer to types.Log and an error if mapping fails.

func GetLogger

func GetLogger(t *testing.T, componentName string) zerolog.Logger

GetLogger instantiates a logger that takes into account the test context and the log level

Types

type AddChainConfig

type AddChainConfig struct {
	ChainID          int64
	PollInterval     time.Duration
	BlockchainClient api.BlockchainClient
}

type Sentinel

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

func NewSentinel

func NewSentinel(cfg SentinelConfig) *Sentinel

NewSentinel initializes and returns a new Sentinel instance.

func (*Sentinel) AddChain

func (s *Sentinel) AddChain(acc AddChainConfig) error

AddChain adds a new chain to Sentinel.

func (*Sentinel) Close

func (s *Sentinel) Close()

Close shuts down all chains and the global registry.

func (*Sentinel) RemoveChain

func (s *Sentinel) RemoveChain(chainID int64) error

RemoveChain removes a chain from Sentinel.

func (*Sentinel) Subscribe

func (s *Sentinel) Subscribe(chainID int64, address common.Address, topic common.Hash) (chan api.Log, error)

Subscribe subscribes to events for a specific chain.

func (*Sentinel) Unsubscribe

func (s *Sentinel) Unsubscribe(chainID int64, address common.Address, topic common.Hash, ch chan api.Log) error

Unsubscribe unsubscribes from events for a specific chain.

type SentinelConfig

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

SentinelConfig holds configuration for the Sentinel.

type SentinelCoordinator added in v0.1.2

type SentinelCoordinator struct {
	Sentinel *Sentinel

	Ctx context.Context
	// contains filtered or unexported fields
}

func NewSentinelCoordinator added in v0.1.2

func NewSentinelCoordinator(log zerolog.Logger) *SentinelCoordinator

Directories

Path Synopsis
File: api/blockchain_client.go
File: api/blockchain_client.go
File: blockchain_client_wrapper/geth_wrapper.go
File: blockchain_client_wrapper/geth_wrapper.go
File: internal/mock_blockchain_client.go
File: internal/mock_blockchain_client.go
chain_poller
File: internal/chain_poller/chain_poller.go
File: internal/chain_poller/chain_poller.go
chain_poller_service
File: internal/chain_poller_service/chain_poller_service.go
File: internal/chain_poller_service/chain_poller_service.go
subscription_manager
File: internal/subscription_manager/subscription_manager.go
File: internal/subscription_manager/subscription_manager.go

Jump to

Keyboard shortcuts

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