provider

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 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 provider defines shared types for all provider implementations.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupported means the operation is not supported on the current OS
	// family. The agent maps this to StatusSkipped instead of StatusFailed.
	ErrUnsupported = behavior.ErrUnsupported

	// ErrNotFound means the thing the request named is not on the host: a user,
	// a group, a service, a cron entry, a sysctl key, a package.
	ErrNotFound = behavior.ErrNotFound

	// ErrNotManaged means the thing exists on the host but osapi did not deploy
	// it, so osapi will not change or remove it. Distinct from ErrNotFound
	// because the answer to the operator is different: the file is there, and
	// something else owns it.
	ErrNotManaged = behavior.ErrNotManaged

	// ErrNotInstalled means a program an operation depends on is absent, so the
	// operation cannot be carried out on this host at all.
	ErrNotInstalled = behavior.ErrNotInstalled

	// ErrInvalid means the host refuses the input, such as a path that is a
	// directory where the operation reads a file.
	ErrInvalid = behavior.ErrInvalid
)

The causes a provider can report that the API answers differently. A provider returns one of these wrapped in an error that says which thing and where, and the agent turns it into a code on the response so the controller does not have to read the sentence back.

Anything else is a failure with no further meaning, which the API answers with 500. Adding a sentinel is how a new distinction reaches an HTTP status; it is never reached by matching on words. The values are internal/behavior's, which behaviors return, so the agent's fact providers under internal/provider/node and a behavior report the same error.

Functions

This section is empty.

Types

type FileState added in v0.3.0

type FileState interface {
	KVGet(ctx context.Context, bucket string, key string) (jetstream.KeyValueEntry, error)
	KVPut(ctx context.Context, bucket string, key string, value []byte) (uint64, error)
}

FileState reads and writes the record of each file that osapi deployed, in the file-state KV bucket. A provider that deploys files keeps one, with the name of the bucket. A *natsclient.Client is one.

Directories

Path Synopsis
Package gohaitest builds a fake host for the tests of the providers that read through gohai: a filesystem with given files, and gohai's generated command runner, configured to answer given command lines.
Package gohaitest builds a fake host for the tests of the providers that read through gohai: a filesystem with given files, and gohai's generated command runner, configured to answer given command lines.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
node
disk
Package disk reads the local disks of the host through gohai.
Package disk reads the local disks of the host through gohai.
disk/mocks
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.
host
Package host reads the facts of the host, such as its hostname, its OS and its uptime.
Package host reads the facts of the host, such as its hostname, its OS and its uptime.
host/mocks
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.
load
Package load reads the load averages of the host.
Package load reads the load averages of the host.
load/mocks
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.
memory
Package memory reads the memory of the host.
Package memory reads the memory of the host.
memory/mocks
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.

Jump to

Keyboard shortcuts

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