Help us shape the future of Go! Take the 2026 Go Developer Survey

central

package
v0.108.3 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package central is the local beekeeper's client of the central instance: beekeeper serve behind muster, called as the person through muster's call_tool. The person signs in once per installation (muster auth login --context); each call takes the endpoint from the muster context and the bearer from muster auth token, and keeps neither.

There is no local copy of what the central instance holds: a call that does not reach it fails with Unreachable, and the caller refuses the verb.

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 central instance's tools.

func New

func New(cfg config.Central, run Runner) *Client

New returns the client of cfg; run nil runs cfg.Muster.

func (*Client) Call

func (c *Client) Call(ctx context.Context, tool string, args map[string]any, v any) (string, error)

Call calls the central instance's tool with args and decodes its structured result into v (nil: none wanted). It returns the tool's text. A refusal is *Refused; a call that did not reach the instance is *Unreachable.

func (*Client) Context

func (c *Client) Context() string

Context is the muster context the client calls through.

func (*Client) Tool

func (c *Client) Tool(name string) string

Tool is the muster name of one of the central instance's tools.

type Refused

type Refused struct {
	Message string
	// Usage marks a call the central instance found malformed: a name it
	// does not know, an argument missing.
	Usage bool
}

Refused is the central instance's refusal: a lease held, a name it does not know, an action that is another person's.

func (*Refused) Error

func (e *Refused) Error() string

type Runner

type Runner func(ctx context.Context, args ...string) ([]byte, error)

Runner runs a muster command and returns its standard output.

type Unreachable

type Unreachable struct {
	Context string
	Reason  string
}

Unreachable is a call that did not reach the central instance: muster's context or sign-in, the network, muster, or beekeeper serve behind it.

func (*Unreachable) Error

func (e *Unreachable) Error() string

Directories

Path Synopsis
Package centraltest gives a test a muster in front of a beekeeper serve: its call_tool forwards x_<server>_<tool> to the backend with the caller's bearer and wraps the result as muster does, and a muster binary that names its endpoint and prints a token.
Package centraltest gives a test a muster in front of a beekeeper serve: its call_tool forwards x_<server>_<tool> to the backend with the caller's bearer and wraps the result as muster does, and a muster binary that names its endpoint and prints a token.

Jump to

Keyboard shortcuts

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