client

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: 10 Imported by: 0

Documentation

Overview

Package client calls the SPECTRE server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client calls the SPECTRE server.

func New

func New(config Config) *Client

New returns a client of the SPECTRE server that config locates.

func (*Client) ClearDivergences

func (c *Client) ClearDivergences(ctx context.Context, service, environment string) error

ClearDivergences removes the divergences of one service environment.

func (*Client) ListDivergences

func (c *Client) ListDivergences(ctx context.Context, filter model.DivergenceFilter) ([]model.State, []model.Divergence, error)

ListDivergences returns the states of the reporting mirrors and the recorded divergences that filter selects, ordered by source.

func (*Client) OpenUpdates added in v0.48.0

func (c *Client) OpenUpdates(ctx context.Context) (*Updates, error)

OpenUpdates opens a stream of a mirror's updates, which lasts until ctx ends or the stream is closed.

type Config

type Config struct {
	URL string `name:"server-url" default:"${server_url}" placeholder:"URL" help:"Base URL of the SPECTRE server."`
	// Socket routes every call through a unix socket, such as a service mesh's
	// egress socket, which routes by the URL's host.
	Socket string `` /* 217-byte string literal not displayed */
}

Config locates the SPECTRE server.

func (Config) Validate added in v0.45.0

func (c Config) Validate() error

Validate checks that a server URL is set. Kong cannot require the flag, because its default, even when empty, counts as set.

type Updates added in v0.48.0

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

Updates streams changes to a mirror's state to the SPECTRE server.

func (*Updates) CloseAndReceive added in v0.48.0

func (u *Updates) CloseAndReceive() error

CloseAndReceive ends the stream and returns the error the server ended it with.

func (*Updates) Keepalive added in v0.48.0

func (u *Updates) Keepalive() error

Keepalive shows the server that a quiet mirror is still connected.

func (*Updates) Send added in v0.48.0

func (u *Updates) Send(update model.Update) error

Send sends update. It fails once the server has ended the stream, and CloseAndReceive then returns why it did.

Jump to

Keyboard shortcuts

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