file

package
v3.3.224 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 47 Imported by: 9

Documentation

Index

Constants

View Source
const (
	DownloadPartChunkSize = int64(1024 * 1024 * 5)
	DownloadPartLimit     = 15
)
View Source
const (
	RetryAll        = RetryPolicyType("RetryAll")
	RetryUnfinished = RetryPolicyType("RetryUnfinished")
)
View Source
const (
	// AdaptiveTransferHighThroughputInitialTarget is the SDK's built-in starting target for high-throughput adaptive transfers.
	AdaptiveTransferHighThroughputInitialTarget = 150
	// AdaptiveTransferConservativeInitialTarget is a lower starting target for consumer desktops and lower-capacity networks.
	AdaptiveTransferConservativeInitialTarget = 50

	// AdaptiveTransferDefaultTargetInitialTarget is the generic transfer target starting concurrency.
	AdaptiveTransferDefaultTargetInitialTarget = 16
	// AdaptiveDownloadDefaultTargetInitialTarget is the generic download target starting concurrency.
	AdaptiveDownloadDefaultTargetInitialTarget = AdaptiveTransferDefaultTargetInitialTarget
	// AdaptiveDownloadDefaultTargetMinTarget is the generic download target minimum concurrency.
	AdaptiveDownloadDefaultTargetMinTarget = 1
	// AdaptiveTransferDefaultTargetGrowEvery is the generic transfer target success count between growth steps.
	AdaptiveTransferDefaultTargetGrowEvery = lib.AdaptiveConcurrencyDefaultGrowEvery
	// AdaptiveTransferDefaultTargetGrowStep is the generic transfer target normal growth step.
	AdaptiveTransferDefaultTargetGrowStep = lib.AdaptiveConcurrencyDefaultGrowStep
	// AdaptiveTransferDefaultTargetFailureShrinkPercent is the generic transfer target shrink percentage after failure.
	AdaptiveTransferDefaultTargetFailureShrinkPercent = lib.AdaptiveConcurrencyDefaultFailureShrinkPercent
	// AdaptiveTransferDefaultTargetBackPressureShrinkPercent is the generic upload target shrink percentage after backpressure.
	AdaptiveTransferDefaultTargetBackPressureShrinkPercent = lib.AdaptiveConcurrencyDefaultBackPressureShrinkPercent
	// AdaptiveDownloadDefaultTargetBackPressureShrinkPercent is the generic download target shrink percentage after backpressure.
	AdaptiveDownloadDefaultTargetBackPressureShrinkPercent = 35
	// AdaptiveTransferDefaultTargetBackPressurePause is the generic upload target pause after backpressure.
	AdaptiveTransferDefaultTargetBackPressurePause = lib.AdaptiveConcurrencyDefaultBackPressurePause
	// AdaptiveDownloadDefaultTargetBackPressurePause is the generic download target pause after backpressure.
	AdaptiveDownloadDefaultTargetBackPressurePause = 500 * time.Millisecond

	// AdaptiveTransferS3MaxConcurrency is the SDK default maximum adaptive concurrency for S3 transfers.
	AdaptiveTransferS3MaxConcurrency = 1024
	// AdaptiveTransferDirectMaxConcurrency is the SDK default maximum adaptive concurrency for direct transfers.
	AdaptiveTransferDirectMaxConcurrency = 256
	// AdaptiveTransferDefaultMaxConcurrency is the SDK default maximum adaptive concurrency for generic transfers.
	AdaptiveTransferDefaultMaxConcurrency = 32
	// AdaptiveTransferDirectInitialTarget is the direct transfer starting concurrency.
	AdaptiveTransferDirectInitialTarget = 32
	// AdaptiveTransferDirectMinTarget is the direct transfer minimum concurrency.
	AdaptiveTransferDirectMinTarget = 8
	// AdaptiveTransferDirectGrowthCeiling is the direct transfer target before throughput-guided probing.
	AdaptiveTransferDirectGrowthCeiling = 64
	// AdaptiveTransferDirectGrowthCeilingProbeSuccesses is the completed part count required before probing above the soft target.
	AdaptiveTransferDirectGrowthCeilingProbeSuccesses = 64
	// AdaptiveTransferS3InitialTarget is the S3 transfer starting concurrency.
	AdaptiveTransferS3InitialTarget = AdaptiveTransferHighThroughputInitialTarget
	// AdaptiveTransferS3MinTarget is the S3 transfer minimum concurrency.
	AdaptiveTransferS3MinTarget = 8
	// AdaptiveTransferS3AdaptiveFloor is the S3 throughput and latency floor.
	AdaptiveTransferS3AdaptiveFloor = 50
	// AdaptiveTransferS3GrowEvery is the S3 success count between growth steps.
	AdaptiveTransferS3GrowEvery = 16
	// AdaptiveTransferS3GrowStep is the S3 normal growth step.
	AdaptiveTransferS3GrowStep = 4
	// AdaptiveTransferS3FailureShrinkPercent is the S3 shrink percentage after failure.
	AdaptiveTransferS3FailureShrinkPercent = 35
	// AdaptiveTransferS3BackPressureShrinkPercent is the S3 shrink percentage after backpressure.
	AdaptiveTransferS3BackPressureShrinkPercent = 10
	// AdaptiveTransferS3BackPressurePause is the S3 pause after backpressure.
	AdaptiveTransferS3BackPressurePause = 0
	// AdaptiveTransferS3ThroughputWindow is the S3 throughput sample window.
	AdaptiveTransferS3ThroughputWindow = 32
	// AdaptiveTransferS3ThroughputMinGainPercent is the S3 required throughput gain percentage.
	AdaptiveTransferS3ThroughputMinGainPercent = 1
	// AdaptiveTransferS3ThroughputShrinkPercent is the S3 shrink percentage after throughput regression.
	AdaptiveTransferS3ThroughputShrinkPercent = 8
	// AdaptiveTransferS3ThroughputHoldWindows is the S3 throughput windows held after shrink.
	AdaptiveTransferS3ThroughputHoldWindows = 1
	// AdaptiveTransferS3ThroughputProbeMinWindows is the S3 repeated probe miss window threshold.
	AdaptiveTransferS3ThroughputProbeMinWindows = 2
	// AdaptiveTransferS3ThroughputProbeFloor is the S3 fast-link probe floor.
	AdaptiveTransferS3ThroughputProbeFloor = AdaptiveTransferHighThroughputInitialTarget
	// AdaptiveTransferS3ThroughputProbeFloorRateBytesPerSecond is the S3 fast-link probe floor rate.
	AdaptiveTransferS3ThroughputProbeFloorRateBytesPerSecond = 96 * 1024 * 1024
	// AdaptiveTransferS3ThroughputProbePlateau is the S3 initial high-throughput probe plateau.
	AdaptiveTransferS3ThroughputProbePlateau = 200
	// AdaptiveTransferS3ThroughputProbeMinGainPerTargetPercent is the S3 required gain per target above the plateau.
	AdaptiveTransferS3ThroughputProbeMinGainPerTargetPercent = 0.15
	// AdaptiveTransferS3ThroughputProbeLossTolerancePercent is the S3 tolerated throughput loss while probing.
	AdaptiveTransferS3ThroughputProbeLossTolerancePercent = 2
	// AdaptiveTransferS3GrowthCeiling is the S3 soft growth target before high-throughput probing.
	AdaptiveTransferS3GrowthCeiling = AdaptiveTransferHighThroughputInitialTarget
	// AdaptiveTransferS3GrowthCeilingProbeBytes is the S3 workload size required before probing above the soft target.
	AdaptiveTransferS3GrowthCeilingProbeBytes = 64 * uploadV2GiB
	// AdaptiveTransferS3GrowthCeilingProbeSuccesses is the S3 success count required before probing above the soft target.
	AdaptiveTransferS3GrowthCeilingProbeSuccesses = 0
	// AdaptiveTransferS3GrowthCeilingProbeRateBytesPerSecond is the S3 throughput required before probing above the soft target.
	AdaptiveTransferS3GrowthCeilingProbeRateBytesPerSecond = 96 * 1024 * 1024
	// AdaptiveTransferS3LatencyShrinkPercent is the S3 shrink percentage after latency pressure.
	AdaptiveTransferS3LatencyShrinkPercent = 8
	// AdaptiveTransferS3LatencyQueueHigh is the S3 latency queue threshold that triggers backoff.
	AdaptiveTransferS3LatencyQueueHigh = 160
	// AdaptiveTransferS3LatencyGrowthQueueHigh is the S3 latency queue threshold that suppresses growth.
	AdaptiveTransferS3LatencyGrowthQueueHigh = 96
	// AdaptiveTransferS3WorkloadTargetPartMultiplier is the S3 desired planned parts per initial target.
	AdaptiveTransferS3WorkloadTargetPartMultiplier = 8
	// AdaptiveTransferS3WorkloadMinPartSizeMiB is the S3 workload-tuned minimum part size.
	AdaptiveTransferS3WorkloadMinPartSizeMiB = 8
	// AdaptiveTransferS3WorkloadScanWaitMillis is the S3 workload scan wait before sizing from estimates.
	AdaptiveTransferS3WorkloadScanWaitMillis = 250
	// AdaptiveTransferDefaultReadyRunwayParts is the default prepared upload runway part count.
	AdaptiveTransferDefaultReadyRunwayParts = 4
	// AdaptiveTransferDefaultReadyRunwayBytes is the default prepared upload runway byte cap.
	AdaptiveTransferDefaultReadyRunwayBytes = 256 * uploadV2MiB
)
View Source
const TempDownloadExtension = "download"

Variables

View Source
var ErrJobPaused = errors.New("job paused")

ErrJobPaused is the cancel cause set when a job is paused rather than fully canceled. Use errors.Is(context.Cause(ctx), ErrJobPaused) to distinguish pause from cancel.

View Source
var UntrustedSizeRangeRequestSizeExpectedReceived = fmt.Errorf("received size did not match server expected size")
View Source
var UntrustedSizeRangeRequestSizeSentLessThanExpected = fmt.Errorf("server send less than expected")
View Source
var UntrustedSizeRangeRequestSizeSentMoreThanExpected = fmt.Errorf("server send more than expected")
View Source
var UntrustedSizeRangeRequestSizeSentReceived = fmt.Errorf("received size did not match server send size")

Functions

func BeginUpload

func BeginUpload(params files_sdk.FileBeginUploadParams, opts ...files_sdk.RequestResponseOption) (fileUploadPartCollection files_sdk.FileUploadPartCollection, err error)

func Copy

func Copy(params files_sdk.FileCopyParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func CopyToChildSite added in v3.3.180

func CopyToChildSite(params files_sdk.FileCopyParams, siteID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func CopyToRemoteServer added in v3.3.180

func CopyToRemoteServer(params files_sdk.FileCopyParams, remoteServerID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func CopyToSnapshot added in v3.3.180

func CopyToSnapshot(params files_sdk.FileCopyParams, snapshotID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func Create

func Create(params files_sdk.FileCreateParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)

func Delete

func Delete(params files_sdk.FileDeleteParams, opts ...files_sdk.RequestResponseOption) (err error)

func DepthFirstWalkDir added in v3.2.15

func DepthFirstWalkDir(root string, fn fs.WalkDirFunc) error

func Find

func Get

func GpgDecrypt added in v3.3.151

func GpgDecrypt(params files_sdk.FileGpgDecryptParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func GpgEncrypt added in v3.3.151

func GpgEncrypt(params files_sdk.FileGpgEncryptParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func Move

func Move(params files_sdk.FileMoveParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func MoveToChildSite added in v3.3.180

func MoveToChildSite(params files_sdk.FileMoveParams, siteID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func MoveToRemoteServer added in v3.3.180

func MoveToRemoteServer(params files_sdk.FileMoveParams, remoteServerID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func MoveToSnapshot added in v3.3.180

func MoveToSnapshot(params files_sdk.FileMoveParams, snapshotID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func OnBytesChange

func OnBytesChange(event status.GetStatus) status.GetStatus

func RetryByPolicy

func RetryByPolicy(ctx context.Context, job *Job, policy RetryPolicy, signalEvents bool)

func RetryByStatus

func RetryByStatus(ctx context.Context, job *Job, signalEvents bool, policy RetryPolicy, s ...status.GetStatus)

func SetJobParams

func SetJobParams(r *Job, d direction.Direction, params interface{}, logger retryablehttp.Logger, remoteFs fs.FS)

func Transform added in v3.3.164

func Transform(params files_sdk.FileTransformParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func Unzip added in v3.3.33

func Unzip(params files_sdk.FileUnzipParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func Update

func Update(params files_sdk.FileUpdateParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)

func UpdateWithMap

func UpdateWithMap(params map[string]interface{}, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)

func UploadToChildSite added in v3.3.180

func UploadToChildSite(siteID int64, destinationPath string, opts ...UploadOption) error

func UploadToRemoteServer added in v3.3.180

func UploadToRemoteServer(remoteServerID int64, destinationPath string, opts ...UploadOption) error

func UploadToSnapshot added in v3.3.180

func UploadToSnapshot(snapshotID int64, destinationPath string, opts ...UploadOption) error

func WaitTellFinished

func WaitTellFinished[T any](job *Job, onStatusComplete chan T, beforeCallingFinish func())

func Zip added in v3.3.33

func Zip(params files_sdk.FileZipParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func ZipListContents added in v3.3.33

func ZipListContents(params files_sdk.FileZipListContentsParams, opts ...files_sdk.RequestResponseOption) (zipListEntryCollection files_sdk.ZipListEntryCollection, err error)

Types

type AdaptiveTransferDefaults added in v3.3.171

type AdaptiveTransferDefaults struct {
	MaxConcurrency int
	InitialTarget  int
}

AdaptiveTransferDefaults contains the primary transfer concurrency defaults callers usually need when initializing adaptive managers directly.

func ConservativeAdaptiveTransferDefaults added in v3.3.171

func ConservativeAdaptiveTransferDefaults() AdaptiveTransferDefaults

ConservativeAdaptiveTransferDefaults returns the SDK's consumer-desktop starting target while keeping room to probe higher on large fast transfers.

func DefaultAdaptiveTransferDefaults added in v3.3.171

func DefaultAdaptiveTransferDefaults() AdaptiveTransferDefaults

DefaultAdaptiveTransferDefaults returns the SDK's high-throughput adaptive transfer defaults.

func (AdaptiveTransferDefaults) AdaptiveConcurrencyConfig added in v3.3.171

AdaptiveConcurrencyConfig returns a manager config that can be passed to lib.NewAdaptiveConcurrencyManagerWithConfig.

type ByteOffset

type ByteOffset struct {
	PartSizes         []int64
	OverrideChunkSize int64
}

func (ByteOffset) BySize

func (b ByteOffset) BySize(size *int64) Iterator

func (ByteOffset) Resume

func (b ByteOffset) Resume(size *int64, off int64, index int) Iterator

Resume creates an iterator that generates file chunks starting from a given offset. When OverrideChunkSize is set (or computed for large files), use a constant-size iterator. Otherwise, use the PartSizes-driven iterator.

type Client

type Client struct {
	files_sdk.Config
}

func (*Client) BeginUpload

func (c *Client) BeginUpload(params files_sdk.FileBeginUploadParams, opts ...files_sdk.RequestResponseOption) (fileUploadPartCollection files_sdk.FileUploadPartCollection, err error)

func (*Client) Copy

func (c *Client) Copy(params files_sdk.FileCopyParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func (*Client) CopyToChildSite added in v3.3.180

func (c *Client) CopyToChildSite(params files_sdk.FileCopyParams, siteID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func (*Client) CopyToRemoteServer added in v3.3.180

func (c *Client) CopyToRemoteServer(params files_sdk.FileCopyParams, remoteServerID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func (*Client) CopyToSnapshot added in v3.3.180

func (c *Client) CopyToSnapshot(params files_sdk.FileCopyParams, snapshotID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func (*Client) Create

func (c *Client) Create(params files_sdk.FileCreateParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)

func (*Client) CreateFolder added in v3.2.80

func (*Client) Delete

func (c *Client) Delete(params files_sdk.FileDeleteParams, opts ...files_sdk.RequestResponseOption) (err error)

func (*Client) Download

func (*Client) DownloadRequestStatus

func (c *Client) DownloadRequestStatus(fileDownloadUrl string, downloadRequestId string, opts ...files_sdk.RequestResponseOption) (files_sdk.ResponseError, error)

func (*Client) DownloadRetry

func (c *Client) DownloadRetry(job Job, opts ...files_sdk.RequestResponseOption) *Job

func (*Client) DownloadToFile

func (c *Client) DownloadToFile(params files_sdk.FileDownloadParams, filePath string, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)

func (*Client) DownloadUri

func (*Client) Downloader

func (c *Client) Downloader(params DownloaderParams, opts ...files_sdk.RequestResponseOption) *Job

func (*Client) FileStats

func (c *Client) FileStats(file files_sdk.File, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)

File{}.Size and File{}.Mtime are not always up to date. This calls HEAD on File{}.DownloadUri to get the latest info. Some Download URLs won't support HEAD. In this case the size is reported as UntrustedSizeValue. The size can be known post download using Client{}.DownloadRequestStatus. This applies to the remote mount types FTP, SFTP, and WebDAV.

func (*Client) Find

func (c *Client) Find(params files_sdk.FileFindParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)

func (*Client) Get

func (c *Client) Get(Path string, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)

func (*Client) GpgDecrypt added in v3.3.151

func (c *Client) GpgDecrypt(params files_sdk.FileGpgDecryptParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func (*Client) GpgEncrypt added in v3.3.151

func (c *Client) GpgEncrypt(params files_sdk.FileGpgEncryptParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func (*Client) ListFor

func (*Client) Move

func (c *Client) Move(params files_sdk.FileMoveParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func (*Client) MoveToChildSite added in v3.3.180

func (c *Client) MoveToChildSite(params files_sdk.FileMoveParams, siteID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func (*Client) MoveToRemoteServer added in v3.3.180

func (c *Client) MoveToRemoteServer(params files_sdk.FileMoveParams, remoteServerID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func (*Client) MoveToSnapshot added in v3.3.180

func (c *Client) MoveToSnapshot(params files_sdk.FileMoveParams, snapshotID int64, destinationPath string, opts ...files_sdk.RequestResponseOption) (files_sdk.FileAction, error)

func (*Client) Transform added in v3.3.164

func (c *Client) Transform(params files_sdk.FileTransformParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func (*Client) Unzip added in v3.3.33

func (c *Client) Unzip(params files_sdk.FileUnzipParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func (*Client) Update

func (c *Client) Update(params files_sdk.FileUpdateParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)

func (*Client) UpdateWithMap

func (c *Client) UpdateWithMap(params map[string]interface{}, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)

func (*Client) Upload

func (c *Client) Upload(opts ...UploadOption) error

func (*Client) UploadFile

func (c *Client) UploadFile(sourcePath string, destinationPath string, opts ...UploadOption) error

UploadFile Deprecated use c.Upload(UploadWithFile(sourcePath), UploadWithDestinationPath(destinationPath))

func (*Client) UploadRetry

func (c *Client) UploadRetry(job Job, opts ...files_sdk.RequestResponseOption) *Job

func (*Client) UploadToChildSite added in v3.3.180

func (c *Client) UploadToChildSite(siteID int64, destinationPath string, opts ...UploadOption) error

func (*Client) UploadToRemoteServer added in v3.3.180

func (c *Client) UploadToRemoteServer(remoteServerID int64, destinationPath string, opts ...UploadOption) error

func (*Client) UploadToSnapshot added in v3.3.180

func (c *Client) UploadToSnapshot(snapshotID int64, destinationPath string, opts ...UploadOption) error

func (*Client) UploadWithResume

func (c *Client) UploadWithResume(opts ...UploadOption) (UploadResumable, error)

func (*Client) Uploader

func (c *Client) Uploader(params UploaderParams, opts ...files_sdk.RequestResponseOption) *Job

func (*Client) Zip added in v3.3.33

func (c *Client) Zip(params files_sdk.FileZipParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)

func (*Client) ZipListContents added in v3.3.33

func (c *Client) ZipListContents(params files_sdk.FileZipListContentsParams, opts ...files_sdk.RequestResponseOption) (zipListEntryCollection files_sdk.ZipListEntryCollection, err error)

type DeleteEmptySourceFolders added in v3.2.8

type DeleteEmptySourceFolders struct {
	direction.Direction
	Config files_sdk.Config
}

DeleteEmptySourceFolders folder after a sync

job.RegisterFileEvent(func(file status.File) {
		log, err := file.DeleteEmptySourceFolders{Direction: f.Direction, Config: config}.Call(ctx, f)
}, status.Complete, status.Skipped)

func (DeleteEmptySourceFolders) Call added in v3.2.8

type DeleteSource

type DeleteSource struct {
	direction.Direction
	Config files_sdk.Config
}

DeleteSource files after a sync

job.RegisterFileEvent(func(file status.File) {
		log, err := file.DeleteSource{Direction: f.Direction, Config: config}.Call(ctx, f)
}, status.Complete, status.Skipped)

func (DeleteSource) Call

type DirEntryError

type DirEntryError struct {
	DirEntries []goFs.DirEntry
	// contains filtered or unexported fields
}

type DirectionalTransferStats added in v3.3.155

type DirectionalTransferStats struct {
	Upload   TransferStats
	Download TransferStats
}

DirectionalTransferStats groups transfer worker usage by direction.

func AdaptiveTransferStats added in v3.3.155

func AdaptiveTransferStats() DirectionalTransferStats

AdaptiveTransferStats returns transfer worker usage for the process-wide adaptive upload and download managers.

type DownloadParts

type DownloadParts struct {
	context.CancelFunc
	context.Context

	fs.File
	fs.FileInfo
	lib.WriterAndAt

	CloseError error
	files_sdk.Config

	*sync.RWMutex
	// contains filtered or unexported fields
}

func (*DownloadParts) FinalSize

func (d *DownloadParts) FinalSize() int64

func (*DownloadParts) Init

func (d *DownloadParts) Init(file fs.File, info fs.FileInfo, globalWait manager.ConcurrencyManager, writer lib.WriterAndAt, config files_sdk.Config, startOffset int64) *DownloadParts

func (*DownloadParts) Run

func (d *DownloadParts) Run(ctx context.Context) error

type DownloadStatus

type DownloadStatus struct {
	fs.FS
	fs.FileInfo

	DownloadedBytes int64

	TmpPath     string
	Sync        bool
	NoOverwrite bool

	Mutex         *sync.RWMutex
	PreserveTimes bool

	status.Changes
	// contains filtered or unexported fields
}

func (*DownloadStatus) EndedAt

func (d *DownloadStatus) EndedAt() time.Time

func (*DownloadStatus) Err

func (d *DownloadStatus) Err() error

func (*DownloadStatus) File

func (d *DownloadStatus) File() files_sdk.File

func (*DownloadStatus) Id

func (d *DownloadStatus) Id() string

func (*DownloadStatus) IncrementTransferBytes

func (d *DownloadStatus) IncrementTransferBytes(b int64)

func (*DownloadStatus) Job

func (d *DownloadStatus) Job() *Job

func (*DownloadStatus) LocalPath

func (d *DownloadStatus) LocalPath() string

func (*DownloadStatus) RecentError

func (d *DownloadStatus) RecentError() error

func (*DownloadStatus) RemotePath

func (d *DownloadStatus) RemotePath() string

func (*DownloadStatus) SetFinalSize

func (d *DownloadStatus) SetFinalSize(written int64)

func (*DownloadStatus) SetStatus

func (d *DownloadStatus) SetStatus(s status.Status, err error)

func (*DownloadStatus) Size

func (d *DownloadStatus) Size() (size int64)

func (*DownloadStatus) StartedAt

func (d *DownloadStatus) StartedAt() time.Time

func (*DownloadStatus) Status

func (d *DownloadStatus) Status() status.Status

func (*DownloadStatus) StatusChanges

func (d *DownloadStatus) StatusChanges() status.Changes

func (*DownloadStatus) TransferBytes

func (d *DownloadStatus) TransferBytes() int64

type DownloadUri

type DownloadUri string

func (DownloadUri) ToTime

func (d DownloadUri) ToTime() (t time.Time, err error)

func (DownloadUri) ToUrl

func (d DownloadUri) ToUrl() (u *url.URL, err error)

func (DownloadUri) Valid

func (d DownloadUri) Valid(within time.Duration) (s DownloadUriValid, valid bool, err error)

type DownloadUriValid

type DownloadUriValid struct {
	*url.URL
	time.Time
	Remaining time.Duration
}

type DownloadV2TargetClassifier added in v3.3.141

type DownloadV2TargetClassifier func(downloadURI string) TransferV2TargetClass

DownloadV2TargetClassifier overrides the SDK's download V2 target classifier. Returning an empty target uses TransferV2TargetDefault.

type DownloaderParams

type DownloaderParams struct {
	// Ignore gitignore formatted pattern
	Ignore []string
	// Include gitignore formatted pattern
	Include       []string
	RemotePath    string
	RemoteFile    files_sdk.File
	LocalPath     string
	TempPath      string // Folder path where the file(s) will be downloaded to before being moved to LocalPath. If not set, the file(s) will be downloaded directly to LocalPath.
	Sync          bool
	PreserveTimes bool
	NoOverwrite   bool
	// SyncAfterActions optionally run source cleanup/move actions after sync comparison.
	SyncAfterActions SyncAfterActions
	RetryPolicy
	*manager.Manager
	EventsReporter

	DryRun             bool
	PriorJobCheckpoint *JobDownloadCheckpoint
	ResumeTmpPath      string // Full path to the temp file from a prior paused download session.
	// AdaptiveConcurrency enables opt-in download V2 adaptive range concurrency.
	AdaptiveConcurrency bool
	// AdaptiveConcurrencyUseSDKDefaultCaps uses SDK V2 caps instead of treating an
	// explicitly supplied Manager as an isolation boundary.
	AdaptiveConcurrencyUseSDKDefaultCaps bool
	// AdaptiveDownloadV2TargetClassifier optionally overrides the SDK's download
	// V2 target classifier. Custom targets use default SDK transfer behavior but
	// keep separate adaptive manager cache entries and telemetry target labels.
	AdaptiveDownloadV2TargetClassifier DownloadV2TargetClassifier
	// AdaptiveDownloadV2TuningSet applies V2 tuning overrides below.
	// When false, V2 uses built-in defaults.
	AdaptiveDownloadV2TuningSet bool
	// AdaptiveDownloadV2Tuning holds opt-in V2 transfer tuning.
	AdaptiveDownloadV2Tuning UploadV2Tuning
	// ZipBatch controls batched small-file downloads through the ZIP download endpoint.
	ZipBatch ZipBatchParams
	// contains filtered or unexported fields
}

type Entity

type Entity struct {
	fs.File
	fs.FS
	// contains filtered or unexported fields
}

type EventsReporter

type EventsReporter map[status.Status][]reporterSettings

func CreateFileEvents

func CreateFileEvents(callback Reporter, events ...status.GetStatus) EventsReporter

type FS

type FS struct {
	files_sdk.Config
	context.Context
	Root string
	// contains filtered or unexported fields
}

func (*FS) Chtimes added in v3.1.50

func (f *FS) Chtimes(name string, _atime time.Time, mtime time.Time) error

func (*FS) ClearCache

func (f *FS) ClearCache()

func (*FS) Create

func (f *FS) Create(path string) (io.WriteCloser, error)

Create Not for performant use cases.

func (*FS) Init

func (f *FS) Init(config files_sdk.Config, cache bool) *FS

func (*FS) MkdirAll

func (f *FS) MkdirAll(dir string, _ goFs.FileMode) error

func (*FS) MkdirTemp

func (f *FS) MkdirTemp(dir, pattern string) (string, error)

func (*FS) Open

func (f *FS) Open(name string) (goFs.File, error)

func (*FS) PathJoin

func (f *FS) PathJoin(s ...string) string

func (*FS) PathSeparator

func (f *FS) PathSeparator() string

func (*FS) ReadDir

func (f *FS) ReadDir(name string) ([]goFs.DirEntry, error)

func (*FS) RelPath

func (f *FS) RelPath(parent, child string) (string, error)

func (*FS) Remove

func (f *FS) Remove(path string) error

func (*FS) RemoveAll

func (f *FS) RemoveAll(path string) error

func (*FS) SplitPath

func (f *FS) SplitPath(path string) (string, string)

func (*FS) TempDir

func (f *FS) TempDir() string

func (*FS) WithContext

func (f *FS) WithContext(ctx context.Context) interface{}

type File

type File struct {
	*files_sdk.File
	*FS
	ReadCloser lib.AtomicValue[io.ReadCloser]

	MaxConnections int

	SizeTrust
	// contains filtered or unexported fields
}

func (*File) Close

func (f *File) Close() error

func (*File) Info

func (f *File) Info() (goFs.FileInfo, error)

func (*File) Init

func (f *File) Init() *File

func (*File) IsDir

func (f *File) IsDir() bool

func (*File) Name

func (f *File) Name() string

func (*File) Read

func (f *File) Read(b []byte) (n int, err error)

func (*File) ReadAt

func (f *File) ReadAt(p []byte, off int64) (n int, err error)

func (*File) ReaderRange

func (f *File) ReaderRange(off int64, end int64) (r io.ReadCloser, err error)

func (*File) Stat

func (f *File) Stat() (goFs.FileInfo, error)

func (*File) Type

func (f *File) Type() goFs.FileMode

func (*File) WithContext

func (f *File) WithContext(ctx context.Context) goFs.File

type IFile

type IFile interface {
	SetStatus(status.Status, error)
	StatusChanges() status.Changes
	TransferBytes() int64
	IncrementTransferBytes(int64)
	File() filesSDK.File
	Size() int64
	Id() string
	LocalPath() string
	RemotePath() string
	Status() status.Status
	EndedAt() time.Time
	StartedAt() time.Time
	Err() error
	Job() *Job
}

type Info

type Info struct {
	files_sdk.File
	// contains filtered or unexported fields
}

func (Info) IsDir

func (i Info) IsDir() bool

func (Info) Mode

func (i Info) Mode() goFs.FileMode

func (Info) Name

func (i Info) Name() string

func (Info) PossibleSize

func (i Info) PossibleSize() int64

func (Info) RemoteMount

func (i Info) RemoteMount() bool

func (Info) Size

func (i Info) Size() int64

func (Info) SizeTrust

func (i Info) SizeTrust() SizeTrust

func (Info) Sys

func (i Info) Sys() interface{}

func (Info) UntrustedSize

func (i Info) UntrustedSize() bool

type Iter

type Iter struct {
	*folder.Iter
}

func (Iter) Iterate

func (i Iter) Iterate(identifier interface{}, opts ...files_sdk.RequestResponseOption) (files_sdk.IterI, error)

func (Iter) LoadResource

func (i Iter) LoadResource(identifier interface{}, opts ...files_sdk.RequestResponseOption) (interface{}, error)

type Iterator

type Iterator func() (OffSet, Iterator, int)

type Job

type Job struct {
	Id string
	*timer.Timer
	Statuses  []IFile
	Direction direction.Direction

	LocalPath  string
	RemotePath string
	Sync       bool
	CodeStart  func()
	context.CancelFunc

	Params interface{}
	Client interface{}
	Config filesSDK.Config
	EventsReporter
	directory.Type
	*manager.Manager
	RetryPolicy    interface{}
	Ignore         *ignore.GitIgnore
	Include        *ignore.GitIgnore
	CompletedPaths map[string]struct{}
	Started        *lib.Signal
	Finished       *lib.Signal
	Canceled       *lib.Signal
	Scanning       *lib.Signal
	EndScanning    *lib.Signal
	retryablehttp.Logger
	RemoteFs fs.FS
	*lib.Meter
	// contains filtered or unexported fields
}

func (*Job) Add

func (r *Job) Add(report IFile)

func (*Job) All

func (r *Job) All(t ...status.GetStatus) bool

func (*Job) Any

func (r *Job) Any(t ...status.GetStatus) (b bool)

func (*Job) Cancel

func (r *Job) Cancel()

func (*Job) ClearCalled

func (r *Job) ClearCalled()

func (*Job) ClearStatuses

func (r *Job) ClearStatuses() Job

func (*Job) Count

func (r *Job) Count(t ...status.GetStatus) int

func (*Job) CountFunc

func (r *Job) CountFunc(call func(IFile) bool, t ...status.GetStatus) int

func (*Job) DownloadCheckpoint added in v3.3.57

func (j *Job) DownloadCheckpoint() *JobDownloadCheckpoint

DownloadCheckpoint builds a JobDownloadCheckpoint from the job's settled file statuses. Call after Wait returns or Finished is signaled; Canceled only indicates that cancellation was requested.

func (*Job) ETA

func (r *Job) ETA() time.Duration

func (*Job) ElapsedTime

func (r *Job) ElapsedTime() time.Duration

func (*Job) EndScan

func (r *Job) EndScan()

func (*Job) EnqueueNext

func (r *Job) EnqueueNext() (f IFile, ok bool)

func (*Job) Files

func (r *Job) Files() []filesSDK.File

func (*Job) FilesRate

func (r *Job) FilesRate() float64

func (*Job) FinalTransferRate

func (r *Job) FinalTransferRate() int64

func (*Job) Find

func (r *Job) Find(t status.GetStatus) (IFile, bool)

func (*Job) FindRemoteFile

func (r *Job) FindRemoteFile(file IFile) (filesSDK.File, bool, error)

func (*Job) Finish

func (r *Job) Finish()

func (*Job) Idle

func (r *Job) Idle() bool

func (*Job) Init

func (r *Job) Init() *Job

func (*Job) Job

func (r *Job) Job() *Job

func (*Job) Percentage

func (r *Job) Percentage(t ...status.GetStatus) int

func (*Job) RegisterFileEvent

func (r *Job) RegisterFileEvent(callback Reporter, events ...status.GetStatus)

func (*Job) RemainingBytes

func (r *Job) RemainingBytes(t ...status.GetStatus) int64

func (*Job) Reset

func (r *Job) Reset()

func (*Job) Scan

func (r *Job) Scan()

func (*Job) ScanDuration added in v3.3.182

func (j *Job) ScanDuration() time.Duration

ScanDuration returns the elapsed time between the job's scan start and scan end signals.

func (*Job) SetEventsReporter

func (r *Job) SetEventsReporter(e EventsReporter)

func (*Job) SetManager

func (r *Job) SetManager(m *manager.Manager)

func (*Job) Start

func (r *Job) Start(ignoreCodeStart ...bool)

func (*Job) StatusFromError

func (r *Job) StatusFromError(s IFile, err error)

func (*Job) Sub

func (r *Job) Sub(t ...status.GetStatus) *Job

func (*Job) TotalBytes

func (r *Job) TotalBytes(t ...status.GetStatus) int64

func (*Job) TransferBytes

func (r *Job) TransferBytes(t ...status.GetStatus) int64

func (*Job) TransferRate

func (r *Job) TransferRate() int64

func (*Job) UpdateStatus

func (r *Job) UpdateStatus(s status.GetStatus, file IFile, err error)

func (*Job) UpdateStatusWithBytes

func (r *Job) UpdateStatusWithBytes(status status.GetStatus, file IFile, bytesCount int64)

func (*Job) UploadCheckpoint added in v3.3.57

func (j *Job) UploadCheckpoint() *JobUploadCheckpoint

UploadCheckpoint builds a JobUploadCheckpoint from the job's settled file statuses. Call after Wait returns or Finished is signaled; Canceled only indicates that cancellation was requested.

func (*Job) Wait

func (r *Job) Wait()

Wait blocks until a started job's completion accounting is settled. A canceled job that never started has no completion work to await.

func (*Job) WithContext

func (r *Job) WithContext(ctx context.Context) context.Context

func (*Job) ZipBatchStats added in v3.3.182

func (j *Job) ZipBatchStats() ZipBatchStatsSnapshot

ZipBatchStats returns ZIP batch activity counters for the job.

type JobDownloadCheckpoint added in v3.3.56

type JobDownloadCheckpoint struct {
	CompletedPaths []string
}

type JobFile

type JobFile struct {
	StatusName          string          `json:"status"`
	TransferBytes       int64           `json:"transferred_bytes"`
	Size                int64           `json:"size_bytes"`
	LocalPath           string          `json:"local_path"`
	RemotePath          string          `json:"remote_path"`
	CheckpointResumable UploadResumable `json:"-"`
	TmpPath             string          `json:"-"`
	EndedAt             time.Time       `json:"completed_at"`
	StartedAt           time.Time       `json:"started_at"`
	Err                 error           `json:"error"`
	Id                  string          `json:"-"`
	Attempts            int             `json:"attempts"`
	Mutex               *sync.RWMutex   `json:"-"`
	status.Status       `json:"-"`
	filesSDK.File       `json:"-"`
	*Job                `json:"-"`
}

func ToStatusFile

func ToStatusFile(f IFile) JobFile

type JobUploadCheckpoint added in v3.3.56

type JobUploadCheckpoint struct {
	CompletedPaths []string
	PendingParts   map[string]UploadResumable // local path → partial upload
}

JobUploadCheckpoint holds folder-level resume state for a paused upload job.

type Len

type Len interface {
	Len() int
}

type MashableError

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

func (MashableError) Err

func (m MashableError) Err() error

func (MashableError) MarshalJSON

func (m MashableError) MarshalJSON() ([]byte, error)

func (MashableError) Unwrap added in v3.2.120

func (m MashableError) Unwrap() error

type MoveSource

type MoveSource struct {
	direction.Direction
	Path   string
	Config files_sdk.Config
}

MoveSource moves a successfully synced source file to Path. For uploads it moves the local source file. For downloads it moves the remote source file.

func (MoveSource) Call

type OffSet

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

type Part

type Part struct {
	OffSet
	files_sdk.EtagsParam

	context.Context
	context.CancelFunc
	*sync.RWMutex

	files_sdk.FileUploadPart
	ProxyReader
	// contains filtered or unexported fields
}

func NewPart added in v3.3.56

func NewPart(number int, off, length, bytes int64, etag, part, errStr string) *Part

func (*Part) Bytes added in v3.3.56

func (p *Part) Bytes() int64

func (*Part) Clear

func (p *Part) Clear()

func (*Part) Done

func (p *Part) Done() *Part

func (*Part) Err

func (p *Part) Err() error

func (*Part) ErrorStr added in v3.3.56

func (p *Part) ErrorStr() string

func (*Part) Len added in v3.3.56

func (p *Part) Len() int64

func (*Part) Number added in v3.3.56

func (p *Part) Number() int

func (*Part) Off added in v3.3.56

func (p *Part) Off() int64

func (*Part) SetError

func (p *Part) SetError(err error)

func (*Part) Start

func (p *Part) Start(ctx ...context.Context) *Part

func (*Part) Successful

func (p *Part) Successful() bool

func (*Part) Touch

func (p *Part) Touch()

func (*Part) WithContext

func (p *Part) WithContext(ctx context.Context) *Part

type PartRunnerReturn

type PartRunnerReturn int

type Parts

type Parts []*Part

func (Parts) SuccessfulBytes

func (p Parts) SuccessfulBytes() (b int64)

type PossibleSize

type PossibleSize interface {
	PossibleSize() int64
}

type Progress

type Progress func(int64)

type ProxyRead

type ProxyRead struct {
	io.Reader
	// contains filtered or unexported fields
}

func (*ProxyRead) BytesRead

func (x *ProxyRead) BytesRead() int64

func (*ProxyRead) Close

func (x *ProxyRead) Close() error

func (*ProxyRead) Len

func (x *ProxyRead) Len() int

func (*ProxyRead) Read

func (x *ProxyRead) Read(p []byte) (int, error)

func (*ProxyRead) ReadDuration added in v3.3.125

func (x *ProxyRead) ReadDuration() time.Duration

func (*ProxyRead) Rewind

func (x *ProxyRead) Rewind() bool

type ProxyReader

type ProxyReader interface {
	io.ReadCloser
	Len() int
	BytesRead() int64
	ReadDuration() time.Duration
	Rewind() bool
}

type ProxyReaderAt

type ProxyReaderAt struct {
	io.ReaderAt
	// contains filtered or unexported fields
}

func (*ProxyReaderAt) BytesRead

func (x *ProxyReaderAt) BytesRead() int64

func (*ProxyReaderAt) Close

func (x *ProxyReaderAt) Close() error

func (*ProxyReaderAt) Len

func (x *ProxyReaderAt) Len() int

func (*ProxyReaderAt) Read

func (x *ProxyReaderAt) Read(p []byte) (int, error)

func (*ProxyReaderAt) ReadDuration added in v3.3.125

func (x *ProxyReaderAt) ReadDuration() time.Duration

func (*ProxyReaderAt) Rewind

func (x *ProxyReaderAt) Rewind() bool

func (*ProxyReaderAt) Seek

func (x *ProxyReaderAt) Seek(offset int64, whence int) (int64, error)

type ProxySectionReader added in v3.3.125

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

func (*ProxySectionReader) BytesRead added in v3.3.125

func (x *ProxySectionReader) BytesRead() int64

func (*ProxySectionReader) Close added in v3.3.125

func (x *ProxySectionReader) Close() error

func (*ProxySectionReader) Len added in v3.3.125

func (x *ProxySectionReader) Len() int

func (*ProxySectionReader) Read added in v3.3.125

func (x *ProxySectionReader) Read(p []byte) (int, error)

func (*ProxySectionReader) ReadDuration added in v3.3.125

func (x *ProxySectionReader) ReadDuration() time.Duration

func (*ProxySectionReader) Rewind added in v3.3.125

func (x *ProxySectionReader) Rewind() bool

type ReadAtLeastWrapper

type ReadAtLeastWrapper struct {
	io.ReadCloser
	io.Reader
}

func (ReadAtLeastWrapper) Close

func (r ReadAtLeastWrapper) Close() error

func (ReadAtLeastWrapper) Read

func (f ReadAtLeastWrapper) Read(b []byte) (n int, err error)

type ReadDirFile

type ReadDirFile struct {
	*File
	// contains filtered or unexported fields
}

func (ReadDirFile) ReadDir

func (f ReadDirFile) ReadDir(n int) ([]goFs.DirEntry, error)

type ReadWrapper

type ReadWrapper struct {
	io.ReadCloser
	// contains filtered or unexported fields
}

func (*ReadWrapper) Read

func (r *ReadWrapper) Read(p []byte) (n int, err error)

type ReaderCloserDownloadStatus

type ReaderCloserDownloadStatus struct {
	*ReadWrapper

	UntrustedSizeRangeRequestSize
	// contains filtered or unexported fields
}

func (ReaderCloserDownloadStatus) Close

type ReaderRange

type ReaderRange interface {
	ReaderRange(off int64, end int64) (io.ReadCloser, error)
	goFs.File
}

type RecursiveItem

type RecursiveItem struct {
	files_sdk.File
	// contains filtered or unexported fields
}

func (RecursiveItem) Err

func (r RecursiveItem) Err() error

type Reporter

type Reporter func(JobFile)

type RetryPolicy

type RetryPolicy struct {
	Type       RetryPolicyType
	RetryCount int
	Backoff    int
}

func (RetryPolicy) WaitSec

func (p RetryPolicy) WaitSec(retry int) time.Duration

type RetryPolicyType

type RetryPolicyType string

type SizeTrust

type SizeTrust int
const (
	NullSizeTrust SizeTrust = iota
	UntrustedSizeValue
	TrustedSizeValue
)

type Subscriptions

type Subscriptions struct {
	Started     chan time.Time
	Finished    chan time.Time
	Canceled    chan time.Time
	Scanning    chan time.Time
	EndScanning chan time.Time
}

type SyncAfterActions added in v3.3.123

type SyncAfterActions struct {
	DeleteSourceFiles        bool
	DeleteSourceEmptyFolders bool
	// MoveSource is the destination path/root for moving synced source files after sync.
	MoveSource string
	// Log receives validation and cleanup action results. If nil, this helper cannot report those errors.
	Log func(status.Log, error)
}

func (SyncAfterActions) Enabled added in v3.3.123

func (a SyncAfterActions) Enabled() bool

func (SyncAfterActions) Validate added in v3.3.123

func (a SyncAfterActions) Validate() error

type TransferStats added in v3.3.155

type TransferStats = manager.TransferStats

TransferStats describes current transfer worker usage.

type TransferV2TargetClass added in v3.3.141

type TransferV2TargetClass string

TransferV2TargetClass identifies the destination class used by adaptive transfer V2. SDK defaults only distinguish S3 from the generic default target; callers may return their own target class names from classifier hooks to isolate adaptive manager learning and telemetry.

const (
	// TransferV2TargetDefault is the generic adaptive transfer target.
	TransferV2TargetDefault TransferV2TargetClass = "default"
	// TransferV2TargetS3 is the adaptive transfer target for S3 upload/download URLs.
	TransferV2TargetS3 TransferV2TargetClass = "s3"
	// TransferV2TargetDirect is the adaptive transfer target for direct transfers.
	TransferV2TargetDirect TransferV2TargetClass = "direct"
)

type UntrustedSize

type UntrustedSize interface {
	UntrustedSize() bool
	SizeTrust() SizeTrust
	goFs.FileInfo
}

type UntrustedSizeRangeRequestSize

type UntrustedSizeRangeRequestSize struct {
	ExpectedSize int64
	SentSize     int64
	ReceivedSize int64
	Status       string
}

func (UntrustedSizeRangeRequestSize) Log

func (u UntrustedSizeRangeRequestSize) Log() map[string]interface{}

func (UntrustedSizeRangeRequestSize) Mismatch

func (u UntrustedSizeRangeRequestSize) Mismatch() error

func (UntrustedSizeRangeRequestSize) VerifyReceived

func (u UntrustedSizeRangeRequestSize) VerifyReceived() error

type UnwrappedError

type UnwrappedError struct {
	OriginalError error
	// contains filtered or unexported fields
}

type UploadOption

type UploadOption func(uploadIO) (uploadIO, error)

func UploadRewindAllProgressOnFailure

func UploadRewindAllProgressOnFailure() UploadOption

UploadRewindAllProgressOnFailure on upload failure rewind all successfully parts

func UploadWithActionAttributes added in v3.2.168

func UploadWithActionAttributes(attributes map[string]any) UploadOption

func UploadWithContext

func UploadWithContext(ctx context.Context) UploadOption

func UploadWithDestinationPath

func UploadWithDestinationPath(destinationPath string) UploadOption

func UploadWithFile

func UploadWithFile(sourcePath string) UploadOption

func UploadWithProgress

func UploadWithProgress(progress Progress) UploadOption

func UploadWithProvidedMtime

func UploadWithProvidedMtime(providedMtime time.Time) UploadOption

func UploadWithProvidedMtimePtr added in v3.2.128

func UploadWithProvidedMtimePtr(providedMtime *time.Time) UploadOption

func UploadWithReader

func UploadWithReader(reader io.Reader) UploadOption

func UploadWithReaderAt

func UploadWithReaderAt(readerAt io.ReaderAt) UploadOption

func UploadWithResume

func UploadWithResume(resume UploadResumable) UploadOption

func UploadWithSize

func UploadWithSize(size int64) UploadOption

func UploadWithV2 added in v3.3.125

func UploadWithV2() UploadOption

UploadWithV2 enables opt-in upload v2 behavior for this upload.

func UploadWithV2ReadyRunway added in v3.3.125

func UploadWithV2ReadyRunway(parts int, bytes int64) UploadOption

UploadWithV2ReadyRunway configures how many V2 upload parts may be prepared ahead of admitted HTTP concurrency. A parts value of 0 disables the runway. A bytes value of 0 leaves queued runway bytes uncapped.

func UploadWithV2TargetClassifier added in v3.3.141

func UploadWithV2TargetClassifier(classifier UploadV2TargetClassifier) UploadOption

UploadWithV2TargetClassifier sets a custom upload V2 target classifier. Custom targets use default SDK transfer behavior but keep separate adaptive manager cache entries and telemetry target labels.

func UploadWithV2Tuning added in v3.3.125

func UploadWithV2Tuning(tuning UploadV2Tuning) UploadOption

UploadWithV2Tuning applies diagnostic tuning overrides to upload V2.

func WithUploadRenamedCallback added in v3.2.228

func WithUploadRenamedCallback(cb func() (path, ref string)) UploadOption

func WithUploadStartedCallback added in v3.2.228

func WithUploadStartedCallback(cb func(files_sdk.FileUploadPart)) UploadOption

type UploadResumable

type UploadResumable struct {
	files_sdk.FileUploadPart
	Parts
	files_sdk.File
	TargetClass TransferV2TargetClass
}

type UploadStatus

type UploadStatus struct {
	Sync        bool
	NoOverwrite bool
	Uploader
	UploadResumable
	Mutex *sync.RWMutex

	status.Changes
	// contains filtered or unexported fields
}

func (*UploadStatus) CheckpointResumable added in v3.3.56

func (u *UploadStatus) CheckpointResumable() UploadResumable

func (*UploadStatus) EndedAt

func (u *UploadStatus) EndedAt() time.Time

func (*UploadStatus) Err

func (u *UploadStatus) Err() error

func (*UploadStatus) File

func (u *UploadStatus) File() files_sdk.File

func (*UploadStatus) Id

func (u *UploadStatus) Id() string

func (*UploadStatus) IncrementTransferBytes

func (u *UploadStatus) IncrementTransferBytes(b int64)

func (*UploadStatus) Job

func (u *UploadStatus) Job() *Job

func (*UploadStatus) LocalPath

func (u *UploadStatus) LocalPath() string

func (*UploadStatus) RecentError

func (u *UploadStatus) RecentError() error

func (*UploadStatus) RemotePath

func (u *UploadStatus) RemotePath() string

func (*UploadStatus) SetStatus

func (u *UploadStatus) SetStatus(s status.Status, err error)

func (*UploadStatus) SetUploadedBytes

func (u *UploadStatus) SetUploadedBytes(b int64)

func (*UploadStatus) Size

func (u *UploadStatus) Size() int64

func (*UploadStatus) StartedAt

func (u *UploadStatus) StartedAt() time.Time

func (*UploadStatus) Status

func (u *UploadStatus) Status() status.Status

func (*UploadStatus) StatusChanges

func (u *UploadStatus) StatusChanges() status.Changes

func (*UploadStatus) TransferBytes

func (u *UploadStatus) TransferBytes() int64

type UploadV2TargetClassifier added in v3.3.141

type UploadV2TargetClassifier func(files_sdk.FileUploadPart) TransferV2TargetClass

UploadV2TargetClassifier overrides the SDK's upload V2 target classifier. Returning an empty target uses TransferV2TargetDefault.

type UploadV2Tuning added in v3.3.125

type UploadV2Tuning struct {
	// InitialTarget is the starting adaptive concurrency target for all transfer targets.
	InitialTarget int
	// GrowthCeiling is the soft concurrency ceiling before throughput-guided probing.
	GrowthCeiling int
	// S3InitialTarget is the starting adaptive concurrency target for S3 uploads.
	S3InitialTarget int
	// S3AdaptiveFloor is the lowest adaptive target the S3 controller should shrink toward.
	S3AdaptiveFloor int
	// S3GrowEvery is the number of successful part samples required before a normal growth step.
	S3GrowEvery int
	// S3GrowStep is the number of additional concurrent part slots added during normal growth.
	S3GrowStep int
	// S3ThroughputWindow is the number of recent part samples used for throughput decisions.
	S3ThroughputWindow int
	// S3ThroughputMinGainPercent is the required throughput improvement for normal growth.
	S3ThroughputMinGainPercent int
	// S3ThroughputProbeMinWindows is the number of missed probe windows before backing off.
	S3ThroughputProbeMinWindows int
	// S3ThroughputProbeFloor is the fast-link target floor used when measured throughput is high.
	S3ThroughputProbeFloor int
	// S3ThroughputProbeFloorRateBytesPerSecond is the measured throughput required to use the probe floor.
	S3ThroughputProbeFloorRateBytesPerSecond int64
	// S3ThroughputProbePlateau is the target used as the first high-throughput probe plateau.
	S3ThroughputProbePlateau int
	// S3ThroughputShrinkPercent is the percent to shrink the target after throughput regression.
	S3ThroughputShrinkPercent int
	// S3ThroughputHoldWindows is the number of throughput windows to hold after a shrink.
	S3ThroughputHoldWindows int
	// S3ThroughputProbeMinGainPerTargetPercent is the minimum gain required per extra target above the plateau.
	S3ThroughputProbeMinGainPerTargetPercent float64
	// S3ThroughputProbeLossTolerancePercent is the tolerated throughput loss while probing above the plateau.
	S3ThroughputProbeLossTolerancePercent int
	// S3GrowthCeiling is the soft concurrency ceiling before large-workload probing unlocks higher targets.
	S3GrowthCeiling int
	// S3GrowthCeilingProbeBytes is the workload size required before probing above the soft ceiling.
	S3GrowthCeilingProbeBytes int64
	// S3GrowthCeilingProbeSuccesses is the successful part count required before probing above the soft ceiling.
	S3GrowthCeilingProbeSuccesses int
	// S3GrowthCeilingProbeRateBytesPerSecond is the throughput required before probing above the soft ceiling.
	S3GrowthCeilingProbeRateBytesPerSecond int64
	// S3LatencyQueueHigh is the observed queue/latency threshold that triggers backoff.
	S3LatencyQueueHigh float64
	// S3LatencyGrowthQueueHigh is the queue/latency threshold that suppresses further growth.
	S3LatencyGrowthQueueHigh float64
	// S3PartSizeMiB forces the known-size S3 part size in MiB. Zero uses the planner.
	S3PartSizeMiB int64
	// S3WorkloadBytes overrides the aggregate upload job size used by the workload-aware planner.
	S3WorkloadBytes int64
	// S3WorkloadTargetPartMultiplier sets desired planned parts per initial target for workload sizing.
	S3WorkloadTargetPartMultiplier int
	// S3WorkloadMinPartSizeMiB sets the minimum workload-tuned S3 part size in MiB.
	S3WorkloadMinPartSizeMiB int64
	// S3WorkloadScanWaitMillis is how long a job may wait for directory scanning before sizing from estimates.
	S3WorkloadScanWaitMillis int
}

UploadV2Tuning overrides transfer V2 defaults for diagnostics and benchmark tuning. Zero values keep the built-in defaults.

type UploaderParams

type UploaderParams struct {
	// Ignore gitignore formatted pattern
	Ignore []string
	// Include gitignore formatted pattern
	Include []string
	// Sync compare destination and only upload if different or non-existent.
	Sync bool
	// LocalPaths files or directories to upload.
	LocalPaths []string
	// LocalPath a file or directory to recursively upload.
	LocalPath string
	// RemotePath destination path for files.com, formatted `/` path separator.
	RemotePath string
	// DryRun see what files would be uploaded.
	DryRun bool
	// NoOverwrite do not overwrite existing files.
	NoOverwrite bool
	// SyncAfterActions optionally run source cleanup/move actions after sync comparison.
	SyncAfterActions SyncAfterActions
	// PriorResumable restores mid-upload state so the upload continues from where it left off.
	PriorResumable UploadResumable
	// PriorJobCheckpoint restores folder-level upload state on resume.
	PriorJobCheckpoint *JobUploadCheckpoint
	// RetryPolicy config for retrying errored uploads.
	RetryPolicy
	// EventsReporter log file events
	EventsReporter
	// Manager limit concurrency
	*manager.Manager
	*Job

	PreserveTimes bool
	// AdaptiveConcurrency explicitly opts this upload job into the upload V2
	// engine. Existing SDK callers remain on the V1 path unless this is true.
	// Any configured concurrent connection limit is used as a maximum cap, not
	// a fixed target.
	AdaptiveConcurrency bool
	// AdaptiveConcurrencyUseSDKDefaultCaps keeps SDK V2 concurrency caps and
	// shared adaptive learning when Manager is present only for job scheduling.
	// When false and Manager is provided, V2 treats that Manager as an explicit
	// isolated cap.
	AdaptiveConcurrencyUseSDKDefaultCaps bool
	// AdaptiveUploadV2TargetClassifier optionally overrides the SDK's upload V2
	// target classifier. Custom targets use default SDK transfer behavior but
	// keep separate adaptive manager cache entries and telemetry target labels.
	AdaptiveUploadV2TargetClassifier UploadV2TargetClassifier
	// AdaptiveUploadReadyRunwaySet applies the ready-runway values below. When
	// false, V2 uses its built-in defaults.
	AdaptiveUploadReadyRunwaySet bool
	// AdaptiveUploadReadyRunwayParts controls how many upload parts V2 may
	// prepare ahead of admitted HTTP concurrency. Zero disables the runway.
	AdaptiveUploadReadyRunwayParts int
	// AdaptiveUploadReadyRunwayBytes caps the extra queued bytes for prepared
	// runway parts. Zero leaves queued runway bytes uncapped.
	AdaptiveUploadReadyRunwayBytes int64
	// AdaptiveUploadV2TuningSet applies V2 tuning overrides below.
	// When false, V2 uses built-in defaults.
	AdaptiveUploadV2TuningSet bool
	// AdaptiveUploadV2Tuning holds opt-in V2 transfer tuning.
	AdaptiveUploadV2Tuning UploadV2Tuning
	// contains filtered or unexported fields
}

type WritableFile

type WritableFile struct {
	*Client
	*FS

	*bytes.Buffer
	// contains filtered or unexported fields
}

func (WritableFile) Close

func (w WritableFile) Close() (err error)

func (WritableFile) Write

func (w WritableFile) Write(p []byte) (int, error)

type ZipBatchExtractionMode added in v3.3.182

type ZipBatchExtractionMode string

ZipBatchExtractionMode selects how ZIP batch archives are extracted.

const (
	// ZipBatchExtractionSpool downloads the ZIP archive to a temporary spool file before extraction.
	ZipBatchExtractionSpool ZipBatchExtractionMode = "spool"
	// ZipBatchExtractionStream extracts the ZIP archive directly from the HTTP response stream.
	ZipBatchExtractionStream ZipBatchExtractionMode = "stream"
)

type ZipBatchParams added in v3.3.182

type ZipBatchParams struct {
	// Disabled turns ZIP batching off entirely.
	Disabled bool
	// Extraction selects spool or stream extraction. Empty uses the SDK default.
	Extraction ZipBatchExtractionMode
	// EligibleSize is the exclusive per-file size ceiling for ZIP batching. Zero uses the SDK default.
	EligibleSize int64
	// MinFiles is the number of eligible small files required before ZIP batching engages. Zero uses the SDK default.
	MinFiles int
	// MaxFiles is the maximum dynamic or pinned file count in one ZIP batch. Zero uses the SDK default.
	MaxFiles int
	// BatchSize pins the number of files per ZIP batch. Zero uses dynamic growth.
	BatchSize int
	// MaxBytes is the maximum listed file bytes in one ZIP batch. Zero uses the SDK default.
	MaxBytes int64
	// ConcurrentBatches is the maximum number of ZIP streams in flight. Zero uses the SDK default.
	ConcurrentBatches int
	// MinAdvantage is the required ZIP/per-file speedup before committing to ZIP batching. Zero uses the SDK default; negative disables probing and batches unconditionally after MinFiles.
	MinAdvantage float64
	// ReprobeInterval is the delay before re-testing ZIP after a dissolve verdict. Zero uses the SDK default; negative disables re-probing.
	ReprobeInterval time.Duration
}

ZipBatchParams controls batched small-file downloads through the ZIP download endpoint.

type ZipBatchStatsSnapshot added in v3.3.182

type ZipBatchStatsSnapshot struct {
	// BatchesDispatched is the number of ZIP batches admitted for download.
	BatchesDispatched int64
	// BatchFiles is the number of files originally assigned to dispatched ZIP batches.
	BatchFiles int64
	// BatchesDissolved is the number of below-gate or below-MinFiles remainders sent to per-file downloads.
	BatchesDissolved int64
	// DissolvedFiles is the number of files in dissolved batches.
	DissolvedFiles int64
	// CreateRequests is the number of ZIP create POST requests, including 422 shrink retries.
	CreateRequests int64
	// StreamAttempts is the number of ZIP stream download attempts.
	StreamAttempts int64
	// StreamFailures is the number of corrupt or failed ZIP stream attempts.
	StreamFailures int64
	// CleanFinalized is the number of files finalized from clean ZIP extraction.
	CleanFinalized int64
	// SalvageFinalized is the number of files finalized from corrupt-spool salvage.
	SalvageFinalized int64
	// FallbackCreateError is the number of files falling back after ZIP create failures.
	FallbackCreateError int64
	// FallbackTripwire is the number of files falling back after correctness tripwires.
	FallbackTripwire int64
	// FallbackRetriesExhausted is the number of files falling back after ZIP retries are exhausted.
	FallbackRetriesExhausted int64
	// FallbackMissingEntry is the number of files falling back because the ZIP omitted expected entries.
	FallbackMissingEntry int64
	// ProbeZipFiles is the number of probe files routed through ZIP batches.
	ProbeZipFiles int64
	// ProbePerFileFiles is the number of probe files routed through per-file downloads.
	ProbePerFileFiles int64
	// ProbeZipRateMilli is measured ZIP probe throughput in files/sec multiplied by 1000.
	ProbeZipRateMilli int64
	// ProbePerFileRateMilli is measured per-file probe throughput in files/sec multiplied by 1000.
	ProbePerFileRateMilli int64
	// ProbeBaselineWindows is the number of per-file windows used for the latest probe baseline.
	ProbeBaselineWindows int64
	// ProbeDecision is none, committed, or dissolved.
	ProbeDecision string
	// CircuitBreakerTrips is the number of times ZIP batching was disabled after repeated retry-exhausted batches.
	CircuitBreakerTrips int64
	// Reprobes is the number of scheduled ZIP re-probe attempts after a dissolve verdict.
	Reprobes int64
}

func (ZipBatchStatsSnapshot) Active added in v3.3.182

func (s ZipBatchStatsSnapshot) Active() bool

Active reports whether the job used or attempted ZIP batching.

func (ZipBatchStatsSnapshot) FallbackFiles added in v3.3.182

func (s ZipBatchStatsSnapshot) FallbackFiles() int64

FallbackFiles returns the total number of files routed from ZIP batches to per-file downloads.

func (ZipBatchStatsSnapshot) StreamRetries added in v3.3.182

func (s ZipBatchStatsSnapshot) StreamRetries() int64

StreamRetries returns ZIP stream attempts after the first attempt for each dispatched batch.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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