coordinator

package
v0.0.0-...-a75a1c7 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Implementation of grpc healthcheck server

The server is implemented directly to allow for up to date information based on env status and for compat with broker.

Coordinator

The current implementation for the ISM coordinator. The go module exports a single `Coordinator` struct, which implements the protobuf `Executor` service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientContainer

type ClientContainer struct {
	Listener net.Listener
	// contains filtered or unexported fields
}

aux data for upstream broker instances

func NewClientContainer

func NewClientContainer(uri string, conn *grpc.ClientConn) *ClientContainer

func (*ClientContainer) SetLoadFactor

func (c *ClientContainer) SetLoadFactor(loadFactor uint32)

type Coordinator

type Coordinator struct {
	proto.UnimplementedBrokerServiceServer // implemented in service.go
	health.UnimplementedHealthServer       // implemented in health.go

	Listener net.Listener // listener handle
	// contains filtered or unexported fields
}

current coordinator implementation container

func NewCoordinator

func NewCoordinator(
	ctx context.Context,
	logger log.Logger,
	rcfg *api.RuntimeConfig,
	listener net.Listener,
) *Coordinator

func (*Coordinator) Check

func (*Coordinator) EnvCheck

func (*Coordinator) EnvCreate

func (*Coordinator) EnvExists

func (*Coordinator) EnvList

func (c *Coordinator) EnvList(ctx context.Context, req *proto.Empty) (*proto.EnvListResponse, error)

func (*Coordinator) EnvStatus

func (*Coordinator) Init

func (c *Coordinator) Init(ctx context.Context) error

initialize state of all upstreams

func (*Coordinator) List

func (*Coordinator) Load

func (c *Coordinator) Load() error

validate config

func (*Coordinator) LoadUpstreams

func (c *Coordinator) LoadUpstreams(upstreams map[string]*ClientContainer) error

inject custom set of upstreams, only intended for testing WARNING: will return an error, if either supplied upstreams is empty or existing upstreams are known

func (*Coordinator) Run

func (c *Coordinator) Run(
	ctx context.Context,
	notifier util.ReadyNotifier,
) error

Start coordinator listener

func (*Coordinator) SelectUpstream

func (c *Coordinator) SelectUpstream(subset iter.Seq[string]) *ClientContainer

SelectUpstream selects the best available upstream from subset.

func (*Coordinator) Stop

func (c *Coordinator) Stop()

Stop coordinator directly (should only be used for testing)

func (*Coordinator) Ticker

func (c *Coordinator) Ticker(ctx context.Context) error

background ticker for polling pool status for upstreams

Source Files

  • health.go
  • service.go

Jump to

Keyboard shortcuts

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