service

package
v1.0.0-dev-2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGoFeatureFlagClient

func NewGoFeatureFlagClient(
	cFlagSet *config.FlagSet,
	logger *zap.Logger,
	notifiers []notifier.Notifier,
) (*ffclient.GoFeatureFlag, error)

func NewNotifierWebsocket

func NewNotifierWebsocket(websocketService WebsocketService) notifier.Notifier

Types

type FlagsetManager

type FlagsetManager interface {
	// FlagSet returns the flag set linked to the API Key
	FlagSet(apiKey string) (*ffclient.GoFeatureFlag, error)
	// FlagSetName returns the name of the flagset linked to the API Key
	FlagSetName(apiKey string) (string, error)
	// AllFlagSets returns all flag sets of the flagset manager
	AllFlagSets() (map[string]*ffclient.GoFeatureFlag, error)
	// Default returns the default flagset
	Default() *ffclient.GoFeatureFlag
	// IsDefaultFlagSet returns true if the manager is in default mode (no flagsets configured)
	IsDefaultFlagSet() bool
	// Close closes the flagset manager
	Close()
	// OnConfigChange is called when the configuration changes
	OnConfigChange(newConfig *config.Config)
}

FlagsetManager is the interface for managing flagsets. It is used to retrieve the flagset linked to the API Key.

func NewFlagsetManager

func NewFlagsetManager(
	config *config.Config, logger *zap.Logger, notifiers []notifier.Notifier) (FlagsetManager, error)

NewFlagsetManager is creating a new FlagsetManager. It is used to retrieve the flagset linked to the API Key.

type Monitoring

type Monitoring interface {
	Health() model.HealthResponse
	Info() (model.InfoResponse, error)
}

Monitoring is the interface of the monitoring service

func NewMonitoring

func NewMonitoring(flagsetManager FlagsetManager) Monitoring

NewMonitoring creates a new implementation of Monitoring

type Services

type Services struct {
	// MonitoringService is the service in charge of managing the monitoring
	MonitoringService Monitoring
	// WebsocketBroadcasterService is the service in charge to manage the websockets in the relay proxy
	WebsocketService WebsocketService
	// Metrics is the service containing all the prometheus metrics
	Metrics metric.Metrics
	// FlagsetManager is the service in charge of managing the flagsets
	FlagsetManager FlagsetManager
}

type WebsocketConnector

type WebsocketConnector interface {
	WriteJSON(v any) error
}

WebsocketConnector is an interface to be able to mock websocket.Conn

type WebsocketService

type WebsocketService interface {
	// Register is adding the connection to the list of open connection.
	Register(c WebsocketConnector)
	// Deregister is removing the connection from the list of open connection.
	Deregister(c WebsocketConnector)
	// BroadcastFlagChanges is sending the diff cache struct to the client.
	BroadcastFlagChanges(diff notifier.DiffCache)
	// Close deregister all open connections.
	Close()
	// WaitForCleanup waits for all connections to be properly closed
	WaitForCleanup(timeout time.Duration) error
}

WebsocketService is the service interface that handle the websocket connections This service is able to broadcast a notification to all the open websockets

func NewWebsocketService

func NewWebsocketService() WebsocketService

NewWebsocketService is a constructor to create a new WebsocketService.

Jump to

Keyboard shortcuts

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