upload

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 13 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

Index

Constants

View Source
const (
	MaxFiles    = 10
	MaxFileSize = 10 * 1024 * 1024
)

Variables

This section is empty.

Functions

func Close

func Close(files []OpenFile)

func IsMissing

func IsMissing(err error) bool

Types

type OpenFile

type OpenFile struct {
	Index    int
	Path     string
	Filename string
	File     *os.File
}

func Validate

func Validate(operands []string, home string) ([]OpenFile, error)

type Options added in v0.1.1

type Options struct {
	Paths   client.WorkspacePaths
	Staging *Staging
	Now     func() time.Time
	Force   bool
}

Options carries the configurable guest layout, the local staging record and the explicit overwrite consent for one upload run.

type Pending added in v0.1.1

type Pending struct {
	OperationUUID string `json:"operation_uuid"`
	Selector      string `json:"selector"`
	Filename      string `json:"filename"`
	Bytes         int64  `json:"bytes"`
	StartedAt     string `json:"started_at"`
}

Pending records one upload the CLI has started but not yet seen resolved. It carries identity and intent only: no file bytes are ever staged locally, so recovery resolves a receipt and never replays a mutation.

type Problem

type Problem struct {
	Code        string `json:"code"`
	Message     string `json:"message"`
	FailedIndex int    `json:"failed_index"`
	// Operation names the upload identity to resolve with daemons files recover
	// or daemons files receipt. It is empty when no request was sent.
	Operation string `json:"operation,omitempty"`
}

type Report

type Report struct {
	Data struct {
		Results []Result `json:"results"`
	} `json:"data"`
	Error *Problem `json:"error"`
	Meta  struct {
		Uploaded  int `json:"uploaded"`
		Requested int `json:"requested"`
	} `json:"meta"`
}

func Run

func Run(ctx context.Context, api *client.Client, daemonID string, files []OpenFile, options Options) (Report, error)

type Result

type Result struct {
	Index  int    `json:"index"`
	Status string `json:"status"`
	Path   string `json:"path,omitempty"`
}

type Staging added in v0.1.1

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

Staging is the per-daemon local record of in-flight upload operations.

func OpenStaging added in v0.1.1

func OpenStaging(environment map[string]string, credentialsFile, daemonID string) (Staging, error)

OpenStaging resolves the private staging record beside the credential file. The daemon identifier becomes one path segment, so it is validated first.

func (Staging) Add added in v0.1.1

func (s Staging) Add(entry Pending, now time.Time) error

Add records an operation before its request leaves the CLI.

func (Staging) List added in v0.1.1

func (s Staging) List() ([]Pending, error)

List returns the pending operations, oldest first. A missing record is empty.

func (Staging) Path added in v0.1.1

func (s Staging) Path() string

Path is the staging record location, for diagnostics and tests.

func (Staging) Remove added in v0.1.1

func (s Staging) Remove(operationUUID string) error

Remove clears one resolved operation. Recovery and a confirmed upload both use it; nothing else may delete a record that is still unresolved.

Jump to

Keyboard shortcuts

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