fetch

package
v0.0.0-...-40cbffd Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package fetch implements the fetch command functionality

Package fetch exposes the distribution fetch flow to the app layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandHandler

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

CommandHandler manages the fetch command operations

func NewCommandHandler

func NewCommandHandler(opts *CommandHandlerOptions) (*CommandHandler, error)

NewCommandHandler creates a new fetch command handler with the provided options.

func (*CommandHandler) Execute

func (h *CommandHandler) Execute(ctx context.Context) error

Execute runs the fetch command to download and filter repositories

func (*CommandHandler) ExecutionSummary

func (h *CommandHandler) ExecutionSummary() ExecutionSummary

ExecutionSummary returns counts from the last fetch execution.

func (*CommandHandler) Setup

func (h *CommandHandler) Setup(ctx context.Context) error

Setup initializes the handler with necessary dependencies and configuration

type CommandHandlerOptions

type CommandHandlerOptions struct {
	Token               string
	BaseURL             string
	DistributionName    string
	OutputDir           string // if empty, use cache path with timestamp
	Files               []string
	WorkersOverride     int
	RateLimitOverride   float64
	TaskTimeoutOverride time.Duration
	WorkersSet          bool
	RateLimitSet        bool
	TaskTimeoutSet      bool
	DryRun              bool
	UseCache            bool // default true
	UUIDFilter          []string
	UserFilter          []string
	// WorkingDir optionally overrides project root detection.
	WorkingDir string
}

CommandHandlerOptions contains options for the fetch command handler.

type Error

Error is a type alias for the generic CommandError.

func NewConfigLoadError

func NewConfigLoadError(err error) *Error

NewConfigLoadError creates a new Error for configuration loading failures.

func NewConfigLoadErrorMsg

func NewConfigLoadErrorMsg(msg string) *Error

NewConfigLoadErrorMsg creates a config-load error with a direct message (no wrapped error).

func NewFilterNoMatchError

func NewFilterNoMatchError(message string) *Error

NewFilterNoMatchError creates a new Error when no repositories match the filter criteria.

func NewOutputDirError

func NewOutputDirError(err error) *Error

NewOutputDirError creates a new Error for output directory resolution failures.

func NewProviderInitError

func NewProviderInitError(err error) *Error

NewProviderInitError creates a new Error for provider initialization failures.

func NewProviderInitErrorMsg

func NewProviderInitErrorMsg(msg string) *Error

NewProviderInitErrorMsg creates a provider-init error with a direct message (no wrapped error).

func NewRemotesLoadError

func NewRemotesLoadError(err error) *Error

NewRemotesLoadError creates a new Error for remotes loading failures.

func NewRepoDownloadError

func NewRepoDownloadError(err error) *Error

NewRepoDownloadError creates a new Error for repository download failures.

func NewRepoDownloadErrorMsg

func NewRepoDownloadErrorMsg(msg string) *Error

NewRepoDownloadErrorMsg creates a repository-download error with a direct message.

func NewWorkingDirError

func NewWorkingDirError(err error) *Error

NewWorkingDirError creates a new Error for working directory determination failures.

type ErrorType

type ErrorType int

ErrorType defines error categories for the fetch command.

const (
	// ErrConfigLoad indicates a configuration loading error
	ErrConfigLoad ErrorType = iota
	// ErrProviderInit indicates provider initialization errors
	ErrProviderInit
	// ErrRemotesLoad indicates remotes loading errors
	ErrRemotesLoad
	// ErrRepoDownload indicates repository download errors
	ErrRepoDownload
	// ErrFilterNoMatch indicates no repositories matched the filter
	ErrFilterNoMatch
	// ErrWorkingDir indicates working directory errors
	ErrWorkingDir
	// ErrOutputDir indicates output directory errors
	ErrOutputDir
)

type ExecutionSummary

type ExecutionSummary struct {
	SuccessCount int
	FailureCount int
}

ExecutionSummary reports completed fetch work.

type Handler

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

Handler orchestrates the fetch flow.

func NewHandler

func NewHandler(opts *HandlerOptions) *Handler

NewHandler constructs a fetch handler with default dependencies.

func (*Handler) Execute

func (h *Handler) Execute(ctx context.Context, req Request) (Result, error)

Execute configures and runs the fetch command handler.

type HandlerOptions

type HandlerOptions struct {
	NewInternalHandler newInternalHandlerFunc
}

HandlerOptions configures how the fetch handler creates its internal command handler.

type ProgressTracker

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

ProgressTracker manages progress reporting for fetch operations

func NewProgressTracker

func NewProgressTracker(total int) *ProgressTracker

NewProgressTracker creates a new progress tracker for fetch operations

func (*ProgressTracker) ReportProgress

func (f *ProgressTracker) ReportProgress(_ string)

ReportProgress updates the progress by incrementing the completed count

func (*ProgressTracker) Stop

func (f *ProgressTracker) Stop()

Stop terminates the progress tracker and cleans up the display

type Request

type Request struct {
	Token               string
	BaseURL             string
	DistributionName    string
	OutputDir           string
	Files               []string
	WorkersOverride     int
	RateLimitOverride   float64
	TaskTimeoutOverride time.Duration
	WorkersSet          bool
	RateLimitSet        bool
	TaskTimeoutSet      bool
	DryRun              bool
	UseCache            bool
	UUIDFilter          []string
	UserFilter          []string
	WorkingDir          string
}

Request contains the input and overrides used for a fetch run.

type Result

type Result struct {
	SuccessCount int
	FailureCount int
}

Result reports fetch execution counts.

Jump to

Keyboard shortcuts

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