providerdispatch

package
v0.4.7 Latest Latest
Warning

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

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

Documentation

Overview

Package providerdispatch centralizes CLI provider construction from parsed provider schemes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDestination

func NewDestination(ctx context.Context, opts DestinationOptions) (provider.Provider, error)

NewDestination constructs a provider for destination options.

func NewSource

func NewSource(ctx context.Context, src *uri.ObjectURI, opts SourceOptions) (provider.Provider, error)

NewSource constructs a provider for a parsed source URI.

func RequireCapability

func RequireCapability[T any](p provider.Provider, command string, providerName string, capability string) (T, error)

RequireCapability returns a typed optional capability or a fail-closed error.

func UseFactoriesForTest

func UseFactoriesForTest(next Factories) func()

UseFactoriesForTest installs temporary constructors and returns a restore function. Tests should call the returned function from t.Cleanup.

Types

type CapabilityError

type CapabilityError struct {
	Command    string
	Provider   string
	Capability string
}

CapabilityError reports a missing optional provider capability.

func (*CapabilityError) Error

func (e *CapabilityError) Error() string

type DestinationOptions

type DestinationOptions struct {
	Command  string
	Provider string

	S3Bucket string
	// S3Prefix is carried for command-owned destination policy. Provider
	// construction uses the bucket; key prefixing remains with the caller.
	S3Prefix    string
	S3          S3Options
	GCSBucket   string
	GCSPrefix   string
	GCS         GCSOptions
	FileBaseDir string

	FileMetadataSidecar string
}

DestinationOptions contains destination-provider construction policy.

type Factories

type Factories struct {
	S3   func(context.Context, s3.Config) (provider.Provider, error)
	GCS  func(context.Context, gcs.Config) (provider.Provider, error)
	File func(providerfile.Config) (provider.Provider, error)
}

Factories holds provider constructors. It is primarily used by command tests to preserve their existing no-network provider stubs.

type GCSOptions

type GCSOptions struct {
	Project              string
	Anonymous            bool
	MaxIdleConnsPerHost  int
	MaxConnsPerHost      int
	WriterChunkSizeBytes int
}

GCSOptions contains command-supplied GCS construction options.

type S3Options

type S3Options struct {
	Region              string
	Profile             string
	Endpoint            string
	ForcePathStyle      bool
	MaxIdleConnsPerHost int
	MaxConnsPerHost     int
}

S3Options contains command-supplied S3 construction options.

type SourceBinding

type SourceBinding struct {
	Provider     provider.Provider
	QuotaDomains []runbudget.Domain
}

SourceBinding pairs a provider handle with the quota domains its requests consume. Keeping the values side-by-side preserves the provider's concrete dynamic type, including optional capabilities; wrapping the provider behind a new type would hide those capabilities from type assertions.

QuotaDomains are conservative service-wide domains. They intentionally do not include bucket, endpoint, profile, project, or credential-derived values: provider endpoint resolution may be ambient, and splitting an unresolved service into narrower identities could let one run multiply load against the same real quota. Conservative sharing can reduce utilization but cannot exceed the configured run ceiling.

func NewSourceBinding

func NewSourceBinding(ctx context.Context, src *uri.ObjectURI, opts SourceOptions) (*SourceBinding, error)

NewSourceBinding constructs a source provider and its provider-supplied quota identity for consumers that enforce a shared run budget.

type SourceOptions

type SourceOptions struct {
	Command               string
	S3                    S3Options
	GCS                   GCSOptions
	FileMetadataSidecar   string
	FileBaseDir           string
	FileSymlinkPolicy     string
	FileRootlessReadMode  string
	FileSelectionMode     string
	FileSelectionManifest string
}

SourceOptions contains source-provider construction policy.

Jump to

Keyboard shortcuts

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