capabilities

package
v0.16.399 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 1 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 capabilities is the one answer to «what does this server do»: GET /api/capabilities, served by the hub and by the runtime in the same shape. It reads the mechanisms that already exist (the hub's feature flags, the runtime's RUNTIME_WEB_FEATURES and service settings) and breaks none of them: it only says, per capability, whether it is on, off, or on once something is configured, and which setting that is.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability struct {
	ID     string `json:"id"`
	Status Status `json:"status"`
	// Reason says why it is not on; empty for a capability that is on.
	Reason string `json:"reason,omitempty"`
	// Configure names the setting that turns it on (an environment variable, a flag), when there is one.
	Configure string `json:"configure,omitempty"`
}

Capability is one thing the web can ask the server to do.

type Document

type Document struct {
	// Server is "hub" or "runtime".
	Server       string       `json:"server"`
	Capabilities []Capability `json:"capabilities"`
}

Document is the body of GET /api/capabilities.

type Set

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

Set collects the capabilities of a server.

func New

func New(server string) *Set

New starts the set of the named server.

func (*Set) Absent

func (s *Set) Absent(id, reason string) *Set

Absent adds a capability this server does not have at all.

func (*Set) Add

func (s *Set) Add(c Capability) *Set

Add puts a capability in, as it is.

func (*Set) Document

func (s *Set) Document() Document

Document is the sorted answer.

func (*Set) Switch

func (s *Set) Switch(id string, on bool, reason, configure string) *Set

Switch adds a capability that is on or off by one setting.

type Status

type Status string

Status is where a capability stands on this server.

const (
	// On: the server serves it.
	On Status = "on"
	// Off: the server does not serve it, and nothing a person sets in it changes that (or it was switched off).
	Off Status = "off"
	// NeedsConfig: the server can serve it once the setting named in Configure is made.
	NeedsConfig Status = "needs_config"
)

Jump to

Keyboard shortcuts

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