shared

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListenerInterval      time.Duration = 2 * time.Second
	EventListenerInterval time.Duration = 5 * time.Second
	MaxTxSendRetries      int           = 4
	TxRetryInterval       time.Duration = 5 * time.Second
)

Variables

This section is empty.

Functions

func EpochsFromChain

func EpochsFromChain(relay *relay.Relay) (*utils.EpochTimingConfig, *utils.RewardEpochConfig, error)

Returns the voting round timing and reward epochs properties from the relay contract.

func ExecuteWithRetryAttempts

func ExecuteWithRetryAttempts[T any](f func(int) (T, error), maxRetries int, delay time.Duration) <-chan ExecuteStatus[T]

func ExecuteWithRetryChan

func ExecuteWithRetryChan[T any](f func() (T, error), maxRetries int, delay time.Duration) <-chan ExecuteStatus[T]

ExecuteWithRetryChan executes function with retry until success or maxRetries. Between each retries there is a delay.

func ExistsAsSubstring

func ExistsAsSubstring(slice []string, s string) bool

ExistsAsSubstring returns true if any of the strings in the slice is a substring of s.

func InitMetricsServer

func InitMetricsServer(cfg *config.Metrics)

func ParseProtocolMessageRelayedEvent

func ParseProtocolMessageRelayedEvent(relay *relay.Relay, dbLog database.Log) (*relay.RelayProtocolMessageRelayed, error)

func ParseSigningPolicyInitializedEvent

func ParseSigningPolicyInitializedEvent(relay *relay.Relay, dbLog database.Log) (*relay.RelaySigningPolicyInitialized, error)

func RewardEpochTimingFromChain

func RewardEpochTimingFromChain(fsm *system.FlareSystemsManager) (*utils.EpochTimingConfig, error)

func Uint16toBytes

func Uint16toBytes(i uint16) (arr [2]byte)

func Uint32toBytes

func Uint32toBytes(i uint32) (arr [4]byte)

func VotingRoundTimingFromChain

func VotingRoundTimingFromChain(fsm *system.FlareSystemsManager) (*utils.EpochTimingConfig, error)

Types

type ExecuteStatus

type ExecuteStatus[T any] struct {
	Success bool
	Message string
	Value   T
}

func ExecuteWithRetryWithContext

func ExecuteWithRetryWithContext[T any](ctx context.Context, f func() (T, error), minimalDuration time.Duration) ExecuteStatus[T]

ExecuteWithRetryWithContext retries function f until success or ctx is canceled. Between each retries there is at least minimalDuration time.

type HealthStatus

type HealthStatus int
const (
	HealthStatusInitializing HealthStatus = 0 // Default prometheus Gauge value, thus it indicates that it was not updated yet.
	HealthStatusOk           HealthStatus = 1
	HealthStatusError        HealthStatus = -1
	HealthStatusSyncing      HealthStatus = -2
)

type Message

type Message []byte

func (Message) Hash

func (msg Message) Hash() []byte

type MetricsBase

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

func NewMetricsBase

func NewMetricsBase(namespace string) *MetricsBase

func (*MetricsBase) SetStatus

func (m *MetricsBase) SetStatus(status HealthStatus)

type ProtocolMessage

type ProtocolMessage struct {
	ProtocolID    uint8
	VotingRoundID uint32
	Message       Message
}

Jump to

Keyboard shortcuts

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