capability

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 3 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 capability holds the one rule every collection status of res/system follows: a state and, where something is missing, why (testdata/capability/v1). Packages keep their own status types and error sentinels and ask this package whether a pair is allowed.

Index

Constants

View Source
const (
	Unsupported = "unsupported"
	Permission  = "permission"
	NoDevice    = "no_device"
	ToolMissing = "tool_missing"
)

The reasons every package shares (testdata/capability/v1).

Variables

This section is empty.

Functions

func Allowed

func Allowed(state, reason string) bool

Allowed reports whether state is known and reason fits it: none for complete and partial, permission or none for permission-denied, unsupported or tool_missing for unsupported, and none, permission, no_device or tool_missing for unavailable. The state exited, which only process observation uses, takes none. The Go observers always give an unavailable status a reason (Unavailable); the empty one stays allowed for a status another binding wrote.

func Unavailable added in v0.5.0

func Unavailable(err error) string

Unavailable is the reason of an unavailable status after a native read failed with err: permission when the system refused the read, tool_missing when a program it needs is not installed, and no_device otherwise, which covers a device, session or source that is absent or did not answer. A nil err, for a read that failed without one, is no_device.

Types

This section is empty.

Jump to

Keyboard shortcuts

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