daemon

package
v0.0.0-...-cba18c7 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package daemon implements the fleet long running daemon.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Message string `json:"message"`
}

APIError is an error response.

type APIResponse

type APIResponse struct {
	Error *APIError `json:"error,omitempty"`
}

APIResponse is the response to an API request.

type Daemon

type Daemon interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error

	Install(ctx context.Context, url string) error
	StartExperiment(ctx context.Context, url string) error
	StopExperiment(ctx context.Context, pkg string) error
	PromoteExperiment(ctx context.Context, pkg string) error

	GetPackage(pkg string, version string) (Package, error)
	GetState() (map[string]repository.State, error)
}

Daemon is the fleet daemon in charge of remote install, updates and configuration.

func NewDaemon

func NewDaemon(rcFetcher client.ConfigFetcher, config config.Reader) (Daemon, error)

NewDaemon returns a new daemon.

type LocalAPI

type LocalAPI interface {
	Start(context.Context) error
	Stop(context.Context) error
}

LocalAPI is the interface for the locally exposed API to interact with the daemon.

func NewLocalAPI

func NewLocalAPI(daemon Daemon, runPath string) (LocalAPI, error)

NewLocalAPI returns a new LocalAPI.

type LocalAPIClient

type LocalAPIClient interface {
	Status() (StatusResponse, error)

	Install(pkg, version string) error
	StartExperiment(pkg, version string) error
	StopExperiment(pkg string) error
	PromoteExperiment(pkg string) error
}

LocalAPIClient is a client to interact with the locally exposed daemon API.

func NewLocalAPIClient

func NewLocalAPIClient(runPath string) LocalAPIClient

NewLocalAPIClient returns a new LocalAPIClient.

type Package

type Package struct {
	Name     string `json:"package"`
	Version  string `json:"version"`
	SHA256   string `json:"sha256"`
	URL      string `json:"url"`
	Size     int64  `json:"size"`
	Platform string `json:"platform"`
	Arch     string `json:"arch"`
}

Package represents a downloadable package.

type StatusResponse

type StatusResponse struct {
	APIResponse
	Version  string                      `json:"version"`
	Packages map[string]repository.State `json:"packages"`
}

StatusResponse is the response to the status endpoint.

Jump to

Keyboard shortcuts

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