command_files

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FilesCmd = &cli.Command{
	Name:  "file",
	Usage: "Manage file storage",
	Description: `Store files in buckets replicated across the knot cluster.

A bucket's files are written bucket:path, e.g. configs:app/settings.toml, and any other path is local. Buckets are private to their owner unless shared; manage them with knot file bucket.

Knot Pro also serves the same buckets over S3 at <server>/s3, using your username as the access key and an API key as the secret key.`,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "server",
			Aliases: []string{"s"},
			Usage:   "The address of the remote server.",
			EnvVars: []string{config.CONFIG_ENV_PREFIX + "_SERVER"},
			Global:  true,
		},
		&cli.StringFlag{
			Name:    "token",
			Aliases: []string{"t"},
			Usage:   "The token to use for authentication.",
			EnvVars: []string{config.CONFIG_ENV_PREFIX + "_TOKEN"},
			Global:  true,
		},
		&cli.BoolFlag{
			Name:         "tls-skip-verify",
			Usage:        "Skip TLS verification.",
			ConfigPath:   []string{"tls.skip_verify"},
			EnvVars:      []string{config.CONFIG_ENV_PREFIX + "_TLS_SKIP_VERIFY"},
			DefaultValue: true,
			Global:       true,
		},
		&cli.StringFlag{
			Name:         "alias",
			Aliases:      []string{"a"},
			Usage:        "The server alias to use from the desktop; inside a space the space's server is used unless an alias is given.",
			DefaultValue: "default",
			Global:       true,
		},
	},
	Commands: []*cli.Command{
		lsCmd,
		copyCmd,
		moveCmd,
		snapshotCmd,
		catCmd,
		rmCmd,
		syncCmd,
		syncProjectCmd,
		usageCmd,
		bucketCmd,
	},
}

FilesCmd is `knot file`: object storage in buckets replicated across the cluster. It works from the desktop (via the configured server) and inside a space (via the agent's connection to its server).

Functions

This section is empty.

Types

type ProjectManager added in v0.42.0

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

ProjectManager runs sync projects in a space's agent: the template's sync block, and the projects started with knot file sync-project start, which are kept on disk so that an agent restart starts them again.

func NewProjectManager added in v0.42.0

func NewProjectManager(ctx context.Context, dir string, client func() (*apiclient.ApiClient, error), l logger.Logger) *ProjectManager

NewProjectManager makes a manager keeping started projects in dir, and syncing with the client client gives.

func (*ProjectManager) Flush added in v0.42.0

func (m *ProjectManager) Flush(ctx context.Context) error

Flush has every project send its local changes now, as the space is about to stop, waiting until they have or ctx ends.

func (*ProjectManager) List added in v0.42.0

List is how the running projects are doing, by name.

func (*ProjectManager) Resume added in v0.42.0

func (m *ProjectManager) Resume()

Resume starts the projects started before the agent last stopped.

func (*ProjectManager) SetTemplate added in v0.42.0

func (m *ProjectManager) SetTemplate(p *syncproject.Project)

SetTemplate runs the template's project, nil for none, replacing the one running if it changed.

func (*ProjectManager) Start added in v0.42.0

func (m *ProjectManager) Start(content, name string) (string, error)

Start runs a project from its file's content, replacing a project of the same name, and keeps it to start again. name is its name when the file gives none. A project already running from the same content, none of its jobs failed, is left running, so a script can start it on every boot. It returns the project's name.

func (*ProjectManager) Stop added in v0.42.0

func (m *ProjectManager) Stop(name string) error

Stop stops a started project and forgets it. The template's keeps running.

func (*ProjectManager) StopAll added in v0.42.0

func (m *ProjectManager) StopAll()

StopAll stops every project, as the agent stops, keeping the started ones to start again.

Jump to

Keyboard shortcuts

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