server

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 16 Imported by: 0 modules, 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

Package server runs the embedded NATS server that osapi starts for itself, and writes its heartbeat.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SubComponents

func SubComponents(
	sc config.NATSServer,
) map[string]job.SubComponentInfo

SubComponents returns the parts of the embedded NATS server that its heartbeat and its metrics server report.

Types

type Server

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

Server is the embedded NATS server. It keeps one client connection to itself, for its heartbeat.

func New

func New(
	ctx context.Context,
	log *slog.Logger,
	cfg config.NATS,
	mp *sdkmetric.MeterProvider,
) (*Server, error)

New starts the embedded NATS server that cfg.Server describes, connects to it, and creates osapi's streams and buckets with bus.Setup. If a step fails, New stops the server and returns the error.

func (*Server) Start

func (s *Server) Start()

Start does nothing. New starts the server, because bus.Setup needs it to run first.

func (*Server) StartHeartbeat

func (s *Server) StartHeartbeat(
	ctx context.Context,
	version string,
	conditions config.ProcessConditions,
)

StartHeartbeat writes the registration of the server to the registry KV bucket until ctx ends, with version, the build version of the binary. If the config names no registry bucket, it logs a warning and returns, because the server runs without a heartbeat.

func (*Server) Stop

func (s *Server) Stop(
	_ context.Context,
)

Stop closes the connection of the server, then stops the server.

Jump to

Keyboard shortcuts

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