coordinator

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package coordinator elects the service leader and distributes service snapshots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	NodeID, Cluster, NodeGroup string
	Elector                    s3lect.Elector
	Storage                    s3lect.Storage
	Controller                 *service.Controller
	Logger                     *slog.Logger
	DialOptions                []grpc.DialOption
	ClientTLS                  *tls.Config
	IPv6Prefix                 netip.Prefix
}

Config configures complete-state service coordination.

type Coordinator

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

Coordinator elects one service manager and distributes complete snapshots.

func New

func New(config Config) (*Coordinator, error)

New validates configuration and creates a coordinator.

func (*Coordinator) Handle

func (c *Coordinator) Handle(ctx context.Context, message *api.ClientMessage) ([]*api.ServerMessage, error)

Handle validates and processes one complete-state gRPC message.

func (*Coordinator) LoadSnapshot

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

LoadSnapshot loads and applies the last durable complete service view.

func (*Coordinator) Run

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

Run starts election and maintains a stream to the elected leader.

func (*Coordinator) Subscribe

func (c *Coordinator) Subscribe() (<-chan *api.ServerMessage, func())

Subscribe receives latest complete snapshots published after subscription.

Jump to

Keyboard shortcuts

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