cluster

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2025 License: MIT Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

nolint:mnd

Index

Constants

View Source
const (
	ErrorConnection = "ERROR_CONNECTION"
	ConfigError     = "ERROR_CONFIG"

	ConfigSendConfigWhenConnected = "CONFIG:SEND_CONFIG_WHEN_CONNECTED"
	ConfigSendConfigChanged       = "CONFIG:SEND_CONFIG_CHANGED"

	ConfigSendRoutesWhenConnected = "CONFIG:SEND_ROUTES_WHEN_CONNECTED"
	ConfigSendRoutesChanged       = "CONFIG:SEND_ROUTES_CHANGED"

	ModuleReady            = "MODULE:READY"
	ModuleSendRequirements = "MODULE:SEND_REQUIREMENTS"
	ModuleSendConfigSchema = "MODULE:SEND_CONFIG_SCHEMA"

	ModuleConnectionSuffix = "MODULE_CONNECTED"
)
View Source
const (
	RequiredAdminPermission = "reqAdminPerm"
)

Variables

This section is empty.

Functions

func GetRequiredAdminPermission

func GetRequiredAdminPermission(desc EndpointDescriptor) (string, bool)

func HideSecrets

func HideSecrets(data []byte) ([]byte, error)

func ModuleConnectedEvent

func ModuleConnectedEvent(moduleName string) string

func RegisterSecretSubstrings

func RegisterSecretSubstrings(substrings []string)

func RequireAdminPermission

func RequireAdminPermission(perm string) map[string]any

func UnregisterSecretSubstrings

func UnregisterSecretSubstrings(substrings []string)

Types

type AddressConfiguration

type AddressConfiguration struct {
	Ip   string
	Port string
}

type BackendDeclaration

type BackendDeclaration struct {
	ModuleName      string
	Version         string
	LibVersion      string
	Endpoints       []EndpointDescriptor
	RequiredModules []ModuleDependency
	Address         AddressConfiguration
}

type Client

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

func NewClient

func NewClient(moduleInfo ModuleInfo, configData ConfigData, hosts []string, logger log.Logger) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Healthcheck

func (c *Client) Healthcheck(ctx context.Context) error

func (*Client) Run

func (c *Client) Run(ctx context.Context, eventHandler *EventHandler) error

type ConfigData

type ConfigData struct {
	Version string
	Schema  json.RawMessage
	Config  json.RawMessage
}

type EndpointDescriptor

type EndpointDescriptor struct {
	Path             string
	HttpMethod       string
	Inner            bool
	UserAuthRequired bool
	Extra            map[string]any
	Handler          any `json:"-"`
}

type EventHandler

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

func NewEventHandler

func NewEventHandler() *EventHandler

func (*EventHandler) RemoteConfigReceiver

func (h *EventHandler) RemoteConfigReceiver(receiver RemoteConfigReceiver) *EventHandler

nolint:mnd

func (*EventHandler) RemoteConfigReceiverWithTimeout

func (h *EventHandler) RemoteConfigReceiverWithTimeout(receiver RemoteConfigReceiver, timeout time.Duration) *EventHandler

func (*EventHandler) RequireModule

func (h *EventHandler) RequireModule(moduleName string, upgrader HostsUpgrader) *EventHandler

func (*EventHandler) RoutesReceiver

func (h *EventHandler) RoutesReceiver(receiver RoutesReceiver) *EventHandler

type HostsUpgrader

type HostsUpgrader interface {
	Upgrade(hosts []string)
}

type ModuleDependency

type ModuleDependency struct {
	Name     string
	Required bool
}

type ModuleInfo

type ModuleInfo struct {
	ModuleName    string
	ModuleVersion string
	LibVersion    string
	OuterAddress  AddressConfiguration
	Endpoints     []EndpointDescriptor
}

type ModuleRequirements

type ModuleRequirements struct {
	RequiredModules []string
	RequireRoutes   bool
}

type RemoteConfigReceiver

type RemoteConfigReceiver interface {
	ReceiveConfig(ctx context.Context, remoteConfig []byte) error
}

type RoutesReceiver

type RoutesReceiver interface {
	ReceiveRoutes(ctx context.Context, routes RoutingConfig) error
}

type RoutingConfig

type RoutingConfig []BackendDeclaration

Jump to

Keyboard shortcuts

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