Documentation
¶
Index ¶
- Constants
- Variables
- func AppLogs(ctx context.Context, app app.ArduinoApp, req AppLogsRequest, ...) (iter.Seq[LogMessage], error)
- func AppStatusEvents(ctx context.Context, cfg config.Configuration, docker command.Cli, ...) iter.Seq2[AppInfo, error]
- func DeleteApp(ctx context.Context, app app.ArduinoApp) error
- func EditApp(req AppEditRequest, editApp *app.ArduinoApp, cfg config.Configuration) (editErr error)
- func GetCustomErrorFomDockerEvent(message string) error
- func GetDefaultApp(cfg config.Configuration) (*app.ArduinoApp, error)
- func RestartApp(ctx context.Context, docker command.Cli, provisioner *Provision, ...) iter.Seq[StreamMessage]
- func SetDefaultApp(app *app.ArduinoApp, cfg config.Configuration) error
- func StartApp(ctx context.Context, docker command.Cli, provisioner *Provision, ...) iter.Seq[StreamMessage]
- func StartDefaultApp(ctx context.Context, docker command.Cli, provisioner *Provision, ...) error
- func StopAndDestroyApp(ctx context.Context, app app.ArduinoApp) iter.Seq[StreamMessage]
- func StopApp(ctx context.Context, app app.ArduinoApp) iter.Seq[StreamMessage]
- func SystemInit(ctx context.Context, cfg config.Configuration, staticStore *store.StaticStore, ...) error
- func SystemResources(ctx context.Context, cfg *SystemResourceConfig) (iter.Seq[SystemResource], error)
- type AIModelItem
- type AIModelsListRequest
- type AIModelsListResult
- type AppDetailedBrick
- type AppDetailedInfo
- type AppEditRequest
- type AppInfo
- type AppLogsRequest
- type AppStatusInfo
- type AppStreamMessage
- type BrokenAppInfo
- type CallbackWriter
- type CloneAppRequest
- type CloneAppResponse
- type ConfigDirectories
- type ConfigResponse
- type CreateAppRequest
- type CreateAppResponse
- type DockerLogConsumer
- type DockerProgressParser
- type LedTrigger
- type LibraryReleaseID
- func AddSketchLibrary(ctx context.Context, app app.ArduinoApp, libRef LibraryReleaseID, addDeps bool) ([]LibraryReleaseID, error)
- func ListSketchLibraries(ctx context.Context, app app.ArduinoApp) ([]LibraryReleaseID, error)
- func NewLibraryReleaseID(name string, version string) LibraryReleaseID
- func ParseLibraryReleaseID(s string) (LibraryReleaseID, error)
- func RemoveSketchLibrary(ctx context.Context, app app.ArduinoApp, libRef LibraryReleaseID) (LibraryReleaseID, error)
- type ListAppRequest
- type ListAppResult
- type LogMessage
- type MessageType
- type Progress
- type Provision
- type Status
- type StreamMessage
- type SystemCPUResource
- type SystemCleanupResult
- type SystemDiskResource
- type SystemMemoryResource
- type SystemResource
- type SystemResourceConfig
Constants ¶
const ( DefaultDockerStopTimeoutSeconds = 5 CameraDevice = "camera" MicrophoneDevice = "microphone" SpeakerDevice = "speaker" )
const ( DockerAppLabel = "cc.arduino.app" DockerAppMainLabel = "cc.arduino.app.main" DockerAppPathLabel = "cc.arduino.app.path" )
Variables ¶
var ( ErrAppAlreadyExists = fmt.Errorf("app already exists") ErrAppDoesntExists = fmt.Errorf("app doesn't exist") )
Functions ¶
func AppLogs ¶
func AppLogs( ctx context.Context, app app.ArduinoApp, req AppLogsRequest, dockerCli command.Cli, staticStore *store.StaticStore, ) (iter.Seq[LogMessage], error)
func AppStatusEvents ¶
func EditApp ¶
func EditApp( req AppEditRequest, editApp *app.ArduinoApp, cfg config.Configuration, ) (editErr error)
func GetDefaultApp ¶
func GetDefaultApp(cfg config.Configuration) (*app.ArduinoApp, error)
func RestartApp ¶ added in v0.6.6
func RestartApp( ctx context.Context, docker command.Cli, provisioner *Provision, modelsIndex *modelsindex.ModelsIndex, bricksIndex *bricksindex.BricksIndex, appToStart app.ArduinoApp, cfg config.Configuration, staticStore *store.StaticStore, ) iter.Seq[StreamMessage]
func SetDefaultApp ¶
func SetDefaultApp(app *app.ArduinoApp, cfg config.Configuration) error
func StartApp ¶
func StartApp( ctx context.Context, docker command.Cli, provisioner *Provision, modelsIndex *modelsindex.ModelsIndex, bricksIndex *bricksindex.BricksIndex, app app.ArduinoApp, cfg config.Configuration, staticStore *store.StaticStore, ) iter.Seq[StreamMessage]
func StartDefaultApp ¶
func StartDefaultApp( ctx context.Context, docker command.Cli, provisioner *Provision, modelsIndex *modelsindex.ModelsIndex, bricksIndex *bricksindex.BricksIndex, idProvider *app.IDProvider, cfg config.Configuration, staticStore *store.StaticStore, ) error
func StopAndDestroyApp ¶
func StopAndDestroyApp(ctx context.Context, app app.ArduinoApp) iter.Seq[StreamMessage]
func StopApp ¶
func StopApp(ctx context.Context, app app.ArduinoApp) iter.Seq[StreamMessage]
func SystemInit ¶
func SystemInit(ctx context.Context, cfg config.Configuration, staticStore *store.StaticStore, docker *command.DockerCli) error
SystemInit pulls necessary Docker images.
func SystemResources ¶
func SystemResources(ctx context.Context, cfg *SystemResourceConfig) (iter.Seq[SystemResource], error)
Types ¶
type AIModelItem ¶
type AIModelItem struct {
ID string `json:"id"`
Name string `json:"name"`
ModuleDescription string `json:"description"`
Runner string `json:"runner"`
Bricks []string `json:"brick_ids"`
Metadata map[string]string `json:"metadata,omitempty"`
ModelConfiguration map[string]string `json:"model_configuration,omitempty"`
}
func AIModelDetails ¶
func AIModelDetails(modelsIndex *modelsindex.ModelsIndex, id string) (AIModelItem, bool)
type AIModelsListRequest ¶
type AIModelsListRequest struct {
FilterByBrickID []string
}
type AIModelsListResult ¶
type AIModelsListResult struct {
Models []AIModelItem `json:"models"`
}
func AIModelsList ¶
func AIModelsList(req AIModelsListRequest, modelsIndex *modelsindex.ModelsIndex) AIModelsListResult
type AppDetailedBrick ¶
type AppDetailedInfo ¶
type AppDetailedInfo struct {
ID app.ID `json:"id" required:"true" `
Name string `json:"name" required:"true"`
Path string `json:"path"`
Description string `json:"description"`
Icon string `json:"icon"`
Status Status `json:"status" required:"true"`
Example bool `json:"example"`
Default bool `json:"default"`
Bricks []AppDetailedBrick `json:"bricks,omitempty"`
}
func AppDetails ¶
func AppDetails( ctx context.Context, docker command.Cli, userApp app.ArduinoApp, bricksIndex *bricksindex.BricksIndex, idProvider *app.IDProvider, cfg config.Configuration, ) (AppDetailedInfo, error)
type AppEditRequest ¶
type AppLogsRequest ¶
type AppStatusInfo ¶
type AppStatusInfo struct {
AppPath *paths.Path
Status Status
}
type AppStreamMessage ¶
type BrokenAppInfo ¶
type CallbackWriter ¶
type CallbackWriter struct {
// contains filtered or unexported fields
}
CallbackWriter is a custom writer that processes each line calling the callback.
func NewCallbackWriter ¶
func NewCallbackWriter(process func(line string)) *CallbackWriter
NewCallbackWriter creates a new CallbackWriter.
type CloneAppResponse ¶
func CloneApp ¶
func CloneApp( ctx context.Context, req CloneAppRequest, idProvider *app.IDProvider, cfg config.Configuration, ) (response CloneAppResponse, cloneErr error)
type ConfigDirectories ¶
type ConfigResponse ¶
type ConfigResponse struct {
Directories ConfigDirectories `json:"directories"`
}
func GetOrchestratorConfig ¶
func GetOrchestratorConfig(cfg config.Configuration) ConfigResponse
type CreateAppRequest ¶
type CreateAppResponse ¶
func CreateApp ¶
func CreateApp( ctx context.Context, req CreateAppRequest, idProvider *app.IDProvider, cfg config.Configuration, ) (CreateAppResponse, error)
type DockerLogConsumer ¶
type DockerLogConsumer struct {
// contains filtered or unexported fields
}
func NewDockerLogConsumer ¶
func NewDockerLogConsumer( ctx context.Context, cb func(LogMessage) bool, mapping map[string]string, ) *DockerLogConsumer
func (*DockerLogConsumer) Err ¶
func (d *DockerLogConsumer) Err(containerName string, message string)
Err implements api.LogConsumer.
func (*DockerLogConsumer) Log ¶
func (d *DockerLogConsumer) Log(containerName string, message string)
Log implements api.LogConsumer.
func (*DockerLogConsumer) Status ¶
func (d *DockerLogConsumer) Status(container string, msg string)
Status implements api.LogConsumer.
type DockerProgressParser ¶
type DockerProgressParser struct {
// contains filtered or unexported fields
}
DockerProgressParser parses Docker pull logs to extract and aggregate progress information.
func NewDockerProgressParser ¶
func NewDockerProgressParser(historySize int) *DockerProgressParser
NewDockerProgressParser creates a new DockerProgressParser instance.
type LedTrigger ¶
type LedTrigger string
const ( LedTriggerNone LedTrigger = "none" LedTriggerDefault LedTrigger = "default" )
type LibraryReleaseID ¶
LibraryReleaseID represents a library release identifier in the form of: - name[@version] Version is optional, if not provided, the latest version available will be used.
func AddSketchLibrary ¶
func AddSketchLibrary(ctx context.Context, app app.ArduinoApp, libRef LibraryReleaseID, addDeps bool) ([]LibraryReleaseID, error)
func ListSketchLibraries ¶
func ListSketchLibraries(ctx context.Context, app app.ArduinoApp) ([]LibraryReleaseID, error)
func NewLibraryReleaseID ¶
func NewLibraryReleaseID(name string, version string) LibraryReleaseID
func ParseLibraryReleaseID ¶
func ParseLibraryReleaseID(s string) (LibraryReleaseID, error)
func RemoveSketchLibrary ¶
func RemoveSketchLibrary(ctx context.Context, app app.ArduinoApp, libRef LibraryReleaseID) (LibraryReleaseID, error)
func (LibraryReleaseID) MarshalJSON ¶
func (l LibraryReleaseID) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for LibraryID.
func (LibraryReleaseID) String ¶
func (l LibraryReleaseID) String() string
type ListAppRequest ¶
type ListAppRequest struct {
ShowExamples bool
ShowOnlyDefault bool
ShowApps bool
StatusFilter Status
// IncludeNonStandardLocationApps will include apps that are not in the standard apps directory.
// We will search by looking for docker container metadata, and add the app not present in the
// standard apps directory in the result list.
IncludeNonStandardLocationApps bool
}
type ListAppResult ¶
type ListAppResult struct {
Apps []AppInfo `json:"apps"`
BrokenApps []BrokenAppInfo `json:"broken_apps"`
}
func ListApps ¶
func ListApps( ctx context.Context, docker command.Cli, req ListAppRequest, idProvider *app.IDProvider, cfg config.Configuration, ) (ListAppResult, error)
type LogMessage ¶
type MessageType ¶
type MessageType string
const ( UnknownType MessageType = "" ProgressType MessageType = "progress" InfoType MessageType = "info" ErrorType MessageType = "error" )
type Provision ¶
type Provision struct {
// contains filtered or unexported fields
}
func NewProvision ¶
func (*Provision) App ¶
func (p *Provision) App( ctx context.Context, bricksIndex *bricksindex.BricksIndex, arduinoApp *app.ArduinoApp, cfg config.Configuration, mapped_env map[string]string, staticStore *store.StaticStore, ) error
type Status ¶
type Status string
func ParseStatus ¶
func StatusFromDockerState ¶
func StatusFromDockerState(s container.ContainerState) Status
func (Status) AllowedStatuses ¶
type StreamMessage ¶
type StreamMessage struct {
// contains filtered or unexported fields
}
func (*StreamMessage) GetData ¶
func (p *StreamMessage) GetData() string
func (*StreamMessage) GetError ¶
func (p *StreamMessage) GetError() error
func (*StreamMessage) GetProgress ¶
func (p *StreamMessage) GetProgress() *Progress
func (*StreamMessage) GetType ¶
func (p *StreamMessage) GetType() MessageType
func (*StreamMessage) IsData ¶
func (p *StreamMessage) IsData() bool
func (*StreamMessage) IsError ¶
func (p *StreamMessage) IsError() bool
func (*StreamMessage) IsProgress ¶
func (p *StreamMessage) IsProgress() bool
type SystemCPUResource ¶
type SystemCPUResource struct {
UsedPercent float64 `json:"used_percent"`
}
type SystemCleanupResult ¶
type SystemCleanupResult struct {
ContainersRemoved int
ImagesRemoved int
RunningAppRemoved bool
SpaceFreed int64 // in bytes
}
func SystemCleanup ¶
func SystemCleanup(ctx context.Context, cfg config.Configuration, staticStore *store.StaticStore, docker command.Cli) (SystemCleanupResult, error)
SystemCleanup removes dangling containers and unused images. Also running apps are stopped and removed.
func (SystemCleanupResult) IsEmpty ¶
func (s SystemCleanupResult) IsEmpty() bool
type SystemDiskResource ¶
type SystemMemoryResource ¶
type SystemResource ¶
type SystemResource interface {
// contains filtered or unexported methods
}