loopsfx

package
v1.12.4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() fx.Option

Module provides lifecycle-managed services for long-running background loops. Hook registration order is intentionally not handled here to keep startup ordering explicit in the composition root.

Types

type BackendMonitoringService

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

BackendMonitoringService provides functionality to monitor backend services at specified intervals.

func NewBackendMonitoringService

func NewBackendMonitoringService(interval time.Duration, cfgProvider configfx.Provider, logger *slog.Logger) *BackendMonitoringService

NewBackendMonitoringService initializes a new BackendMonitoringService with the provided monitoring interval.

func NewDefaultBackendMonitoringService

func NewDefaultBackendMonitoringService(cfgProvider configfx.Provider, logger *slog.Logger) *BackendMonitoringService

NewDefaultBackendMonitoringService creates a BackendMonitoringService with a default delay for backend monitoring.

func (*BackendMonitoringService) Restart

Restart restarts the backend monitoring service by stopping and then starting its monitoring loop.

func (*BackendMonitoringService) Start

func (s *BackendMonitoringService) Start(parent context.Context) error

Start begins backend monitoring by initializing context, ticker, and spawning monitoring goroutine.

func (*BackendMonitoringService) Stop

func (s *BackendMonitoringService) Stop(stopCtx context.Context) error

Stop terminates the backend monitoring process, stops the ticker, cancels the context, and waits for all goroutines to finish.

type BruteForceSyncService

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

BruteForceSyncService is a background service that listens for global brute-force block events via Redis Pub/Sub and updates the local L1 micro-cache accordingly.

func NewBruteForceSyncService

func NewBruteForceSyncService(cfgProvider configfx.Provider, logger *slog.Logger, redisClient redifx.Client) *BruteForceSyncService

NewBruteForceSyncService initializes and returns a BruteForceSyncService.

func (*BruteForceSyncService) Start

func (s *BruteForceSyncService) Start(parent context.Context) error

Start begins the Pub/Sub listener loop.

func (*BruteForceSyncService) Stop

func (s *BruteForceSyncService) Stop(stopCtx context.Context) error

Stop terminates the sync service and waits for the listener to exit.

type ConnMgrService

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

ConnMgrService manages the lifecycle of connection monitoring with configurable intervals and context handling.

func NewConnMgrService

func NewConnMgrService(interval time.Duration, startGenericConnections func(context.Context), cfgProvider configfx.Provider, logger *slog.Logger) *ConnMgrService

NewConnMgrService initializes and returns a new instance of ConnMgrService with the given interval and start function.

func NewDefaultConnMgrService

func NewDefaultConnMgrService(cfgProvider configfx.Provider, logger *slog.Logger) *ConnMgrService

NewDefaultConnMgrService creates a ConnMgrService with default settings for connection monitoring and context handling.

func (*ConnMgrService) Start

func (s *ConnMgrService) Start(parent context.Context) error

Start initializes and starts the connection monitoring process with the provided parent context.

func (*ConnMgrService) Stop

func (s *ConnMgrService) Stop(stopCtx context.Context) error

Stop terminates the connection monitoring service.

It attempts to stop within the provided context deadline.

type StatsService

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

StatsService is a service that manages periodic tasks and CPU usage monitoring using a defined interval and hooks.

func NewDefaultStatsService

func NewDefaultStatsService(cfgProvider configfx.Provider, logger *slog.Logger, redisClient redifx.Client) *StatsService

NewDefaultStatsService initializes and returns a StatsService with default settings for statistical monitoring tasks.

func NewStatsService

func NewStatsService(interval time.Duration, startMeasureCPU func(context.Context), onTick func(context.Context)) *StatsService

NewStatsService initializes a StatsService with a specified interval, CPU measurement function, and tick callback.

func (*StatsService) Start

func (s *StatsService) Start(parent context.Context) error

Start begins the service, initializing its context, ticker, and running state, and spawns necessary goroutines for tasks.

func (*StatsService) Stop

func (s *StatsService) Stop(stopCtx context.Context) error

Stop terminates the stats service.

It attempts to stop within the provided context deadline.

Jump to

Keyboard shortcuts

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