service

package
v0.0.0-...-e163d20 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

Broker manages clients and messages.

func NewBroker

func NewBroker() *Broker

func (*Broker) Broadcast

func (b *Broker) Broadcast(data *ConfigUpdate)

func (*Broker) Cleanup

func (b *Broker) Cleanup(_ context.Context)

func (*Broker) Run

func (b *Broker) Run(ctx context.Context)

func (*Broker) Subscribe

func (b *Broker) Subscribe(ctx context.Context, client *Client)

func (*Broker) Unsubscribe

func (b *Broker) Unsubscribe(ctx context.Context, client *Client)

type Client

type Client struct {
	Send chan *ConfigUpdate
	// contains filtered or unexported fields
}

Client represents a subscriber with a channel to send messages.

type ConfigUpdate

type ConfigUpdate struct {
	Env     string `json:"env"`
	Repo    string `json:"repo"`
	Version string `json:"version"`
}

type NotifyService

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

func New

func New(remote bool) *NotifyService

New creates a new instance of the NotifyService.

func (*NotifyService) NotifyConfigUpdate

func (n *NotifyService) NotifyConfigUpdate(ctx context.Context, repo, env, version string)

NotifyConfigUpdate notifies all nodes and local subscribers about a configuration update.

func (*NotifyService) NotifyGlobally

func (n *NotifyService) NotifyGlobally(ctx context.Context, cu *ConfigUpdate) error

func (*NotifyService) NotifyLocally

func (n *NotifyService) NotifyLocally(cu *ConfigUpdate)

func (*NotifyService) RunGlobal

func (n *NotifyService) RunGlobal(ctx context.Context)

RunGlobal starts the global notification service

func (*NotifyService) RunLocal

func (n *NotifyService) RunLocal(ctx context.Context)

RunLocal starts the local notification service, particularly the broker's run loop.

func (*NotifyService) ShutdownGlobal

func (n *NotifyService) ShutdownGlobal()

func (*NotifyService) ShutdownLocal

func (n *NotifyService) ShutdownLocal(ctx context.Context)

func (*NotifyService) Subscribe

func (n *NotifyService) Subscribe(ctx context.Context, env string) *Client

func (*NotifyService) Unsubscribe

func (n *NotifyService) Unsubscribe(ctx context.Context, client *Client)

Jump to

Keyboard shortcuts

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