server

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package server is the SPECTRE server, which collects the states that mirrors stream. It keeps their states and divergences in memory or in Redis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, config ServeConfig) error

Serve runs a SPECTRE server until ctx is cancelled. Mesh mTLS secures it, so it serves plaintext HTTP/1 and unencrypted HTTP/2.

Types

type ClearConfig

type ClearConfig struct {
	Service     string `required:"" help:"Service whose divergences to clear."`
	Environment string `required:"" help:"Environment whose divergences to clear."`
}

ClearConfig names the service environment whose divergences to clear.

type ServeConfig

type ServeConfig struct {
	Listen   string         `default:"127.0.0.1:50070" help:"Address for the SPECTRE server: host:port, or unix:<path|@abstract>."`
	Storage  storage.Config `embed:""`
	StateTTL time.Duration  `` /* 126-byte string literal not displayed */
}

ServeConfig configures the SPECTRE server.

type Service

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

Service serves the SPECTRE service API.

func NewService

func NewService(store storage.Store, ttl time.Duration) *Service

NewService returns a SPECTRE server that keeps mirror states and divergences in store, and lists the states received within ttl.

func (*Service) ClearDivergences

func (s *Service) ClearDivergences(ctx context.Context, request *pb.ClearDivergencesRequest) (*pb.ClearDivergencesResponse, error)

ClearDivergences removes the divergences of one service environment.

func (*Service) Handler

func (s *Service) Handler() http.Handler

Handler serves the API.

func (*Service) ListDivergences

func (s *Service) ListDivergences(ctx context.Context, request *pb.ListDivergencesRequest) (*pb.ListDivergencesResponse, error)

ListDivergences returns the states of the mirrors that sent an update within the TTL, and every recorded divergence.

func (*Service) Update added in v0.47.0

Update keeps the state a mirror streams. Every message stores the whole state, which keeps it listed, and records the divergence of each quarantine.

Directories

Path Synopsis
Package client calls the SPECTRE server.
Package client calls the SPECTRE server.
Package reporter streams what a mirror sends the SPECTRE server over one stream.
Package reporter streams what a mirror sends the SPECTRE server over one stream.
Package storage keeps the states that mirrors report to the SPECTRE server.
Package storage keeps the states that mirrors report to the SPECTRE server.
Package wire converts between the SPECTRE service protocol and the domain model, so only the server's API boundary handles protocol messages.
Package wire converts between the SPECTRE service protocol and the domain model, so only the server's API boundary handles protocol messages.

Jump to

Keyboard shortcuts

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