Documentation
¶
Index ¶
- Constants
- Variables
- func BeginUpload(params files_sdk.FileBeginUploadParams, ...) (fileUploadPartCollection files_sdk.FileUploadPartCollection, err error)
- func Copy(params files_sdk.FileCopyParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)
- func Create(params files_sdk.FileCreateParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)
- func Delete(params files_sdk.FileDeleteParams, opts ...files_sdk.RequestResponseOption) (err error)
- func DepthFirstWalkDir(root string, fn fs.WalkDirFunc) error
- func Download(params files_sdk.FileDownloadParams, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)
- func Find(params files_sdk.FileFindParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)
- func Get(Path string, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)
- func Move(params files_sdk.FileMoveParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)
- func OnBytesChange(event status.GetStatus) status.GetStatus
- func RetryByPolicy(ctx context.Context, job *Job, policy RetryPolicy, signalEvents bool)
- func RetryByStatus(ctx context.Context, job *Job, signalEvents bool, policy RetryPolicy, ...)
- func SetJobParams(r *Job, d direction.Direction, params interface{}, logger retryablehttp.Logger, ...)
- func Update(params files_sdk.FileUpdateParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)
- func UpdateWithMap(params map[string]interface{}, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)
- func WaitTellFinished[T any](job *Job, onStatusComplete chan T, beforeCallingFinish func())
- type ByteOffset
- type Client
- func (c *Client) BeginUpload(params files_sdk.FileBeginUploadParams, ...) (fileUploadPartCollection files_sdk.FileUploadPartCollection, err error)
- func (c *Client) Copy(params files_sdk.FileCopyParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)
- func (c *Client) Create(params files_sdk.FileCreateParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)
- func (c *Client) CreateFolder(params files_sdk.FolderCreateParams, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)
- func (c *Client) Delete(params files_sdk.FileDeleteParams, opts ...files_sdk.RequestResponseOption) (err error)
- func (c *Client) Download(params files_sdk.FileDownloadParams, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)
- func (c *Client) DownloadRequestStatus(fileDownloadUrl string, downloadRequestId string, ...) (files_sdk.ResponseError, error)
- func (c *Client) DownloadRetry(job Job, opts ...files_sdk.RequestResponseOption) *Job
- func (c *Client) DownloadToFile(params files_sdk.FileDownloadParams, filePath string, ...) (files_sdk.File, error)
- func (c *Client) DownloadUri(params files_sdk.FileDownloadParams, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)
- func (c *Client) Downloader(params DownloaderParams, opts ...files_sdk.RequestResponseOption) *Job
- func (c *Client) FileStats(file files_sdk.File, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)
- func (c *Client) Find(params files_sdk.FileFindParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)
- func (c *Client) Get(Path string, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)
- func (c *Client) ListFor(params files_sdk.FolderListForParams, opts ...files_sdk.RequestResponseOption) (Iter, error)
- func (c *Client) ListForRecursive(params files_sdk.FolderListForParams, opts ...files_sdk.RequestResponseOption) (files_sdk.TypedIterI[RecursiveItem], error)
- func (c *Client) Move(params files_sdk.FileMoveParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)
- func (c *Client) Update(params files_sdk.FileUpdateParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)
- func (c *Client) UpdateWithMap(params map[string]interface{}, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)
- func (c *Client) Upload(opts ...UploadOption) error
- func (c *Client) UploadFile(sourcePath string, destinationPath string, opts ...UploadOption) error
- func (c *Client) UploadRetry(job Job, opts ...files_sdk.RequestResponseOption) *Job
- func (c *Client) UploadWithResume(opts ...UploadOption) (UploadResumable, error)
- func (c *Client) Uploader(params UploaderParams, opts ...files_sdk.RequestResponseOption) *Job
- type DeleteEmptySourceFolders
- type DeleteSource
- type DirEntryError
- type DownloadParts
- type DownloadStatus
- func (d *DownloadStatus) EndedAt() time.Time
- func (d *DownloadStatus) Err() error
- func (d *DownloadStatus) File() files_sdk.File
- func (d *DownloadStatus) Id() string
- func (d *DownloadStatus) IncrementTransferBytes(b int64)
- func (d *DownloadStatus) Job() *Job
- func (d *DownloadStatus) LocalPath() string
- func (d *DownloadStatus) RecentError() error
- func (d *DownloadStatus) RemotePath() string
- func (d *DownloadStatus) SetFinalSize(written int64)
- func (d *DownloadStatus) SetStatus(s status.Status, err error)
- func (d *DownloadStatus) Size() (size int64)
- func (d *DownloadStatus) StartedAt() time.Time
- func (d *DownloadStatus) Status() status.Status
- func (d *DownloadStatus) StatusChanges() status.Changes
- func (d *DownloadStatus) TransferBytes() int64
- type DownloadUri
- type DownloadUriValid
- type DownloaderParams
- type Entity
- type EventsReporter
- type FS
- func (f *FS) Chtimes(name string, _atime time.Time, mtime time.Time) error
- func (f *FS) ClearCache()
- func (f *FS) Create(path string) (io.WriteCloser, error)
- func (f *FS) Init(config files_sdk.Config, cache bool) *FS
- func (f *FS) MkdirAll(dir string, _ goFs.FileMode) error
- func (f *FS) MkdirTemp(dir, pattern string) (string, error)
- func (f *FS) Open(name string) (goFs.File, error)
- func (f *FS) PathJoin(s ...string) string
- func (f *FS) PathSeparator() string
- func (f *FS) ReadDir(name string) ([]goFs.DirEntry, error)
- func (f *FS) RelPath(parent, child string) (string, error)
- func (f *FS) Remove(path string) error
- func (f *FS) RemoveAll(path string) error
- func (f *FS) SplitPath(path string) (string, string)
- func (f *FS) TempDir() string
- func (f *FS) WithContext(ctx context.Context) interface{}
- type File
- func (f *File) Close() error
- func (f *File) Info() (goFs.FileInfo, error)
- func (f *File) Init() *File
- func (f *File) IsDir() bool
- func (f *File) Name() string
- func (f *File) Read(b []byte) (n int, err error)
- func (f *File) ReadAt(p []byte, off int64) (n int, err error)
- func (f *File) ReaderRange(off int64, end int64) (r io.ReadCloser, err error)
- func (f *File) Stat() (goFs.FileInfo, error)
- func (f *File) Type() goFs.FileMode
- func (f *File) WithContext(ctx context.Context) goFs.File
- type IFile
- type Info
- type Iter
- type Iterator
- type Job
- func (r *Job) Add(report IFile)
- func (r *Job) All(t ...status.GetStatus) bool
- func (r *Job) Any(t ...status.GetStatus) (b bool)
- func (r *Job) Cancel()
- func (r *Job) ClearCalled()
- func (r *Job) ClearStatuses() Job
- func (r *Job) Count(t ...status.GetStatus) int
- func (r *Job) CountFunc(call func(IFile) bool, t ...status.GetStatus) int
- func (r *Job) ETA() time.Duration
- func (r *Job) ElapsedTime() time.Duration
- func (r *Job) EndScan()
- func (r *Job) EnqueueNext() (f IFile, ok bool)
- func (r *Job) Files() []filesSDK.File
- func (r *Job) FilesRate() float64
- func (r *Job) FinalTransferRate() int64
- func (r *Job) Find(t status.GetStatus) (IFile, bool)
- func (r *Job) FindRemoteFile(file IFile) (filesSDK.File, bool, error)
- func (r *Job) Finish()
- func (r *Job) Idle() bool
- func (r *Job) Init() *Job
- func (r *Job) Job() *Job
- func (r *Job) Percentage(t ...status.GetStatus) int
- func (r *Job) RegisterFileEvent(callback Reporter, events ...status.GetStatus)
- func (r *Job) RemainingBytes(t ...status.GetStatus) int64
- func (r *Job) Reset()
- func (r *Job) Scan()
- func (r *Job) SetEventsReporter(e EventsReporter)
- func (r *Job) SetManager(m *manager.Manager)
- func (r *Job) Start(ignoreCodeStart ...bool)
- func (r *Job) StatusFromError(s IFile, err error)
- func (r *Job) Sub(t ...status.GetStatus) *Job
- func (r *Job) TotalBytes(t ...status.GetStatus) int64
- func (r *Job) TransferBytes(t ...status.GetStatus) int64
- func (r *Job) TransferRate() int64
- func (r *Job) UpdateStatus(s status.GetStatus, file IFile, err error)
- func (r *Job) UpdateStatusWithBytes(status status.GetStatus, file IFile, bytesCount int64)
- func (r *Job) Wait()
- func (r *Job) WithContext(ctx context.Context) context.Context
- type JobFile
- type Len
- type MashableError
- type MoveSource
- type OffSet
- type Part
- type PartRunnerReturn
- type Parts
- type PossibleSize
- type Progress
- type ProxyRead
- type ProxyReader
- type ProxyReaderAt
- type ReadAtLeastWrapper
- type ReadDirFile
- type ReadWrapper
- type ReaderCloserDownloadStatus
- type ReaderRange
- type RecursiveItem
- type Reporter
- type RetryPolicy
- type RetryPolicyType
- type SizeTrust
- type Subscriptions
- type UntrustedSize
- type UntrustedSizeRangeRequestSize
- type UnwrappedError
- type UploadOption
- func UploadRewindAllProgressOnFailure() UploadOption
- func UploadWithActionAttributes(attributes map[string]any) UploadOption
- func UploadWithContext(ctx context.Context) UploadOption
- func UploadWithDestinationPath(destinationPath string) UploadOption
- func UploadWithFile(sourcePath string) UploadOption
- func UploadWithManager(manager lib.ConcurrencyManagerWithSubWorker) UploadOption
- func UploadWithProgress(progress Progress) UploadOption
- func UploadWithProvidedMtime(providedMtime time.Time) UploadOption
- func UploadWithProvidedMtimePtr(providedMtime *time.Time) UploadOption
- func UploadWithReader(reader io.Reader) UploadOption
- func UploadWithReaderAt(readerAt io.ReaderAt) UploadOption
- func UploadWithResume(resume UploadResumable) UploadOption
- func UploadWithSize(size int64) UploadOption
- func WithUploadRenamedCallback(cb func() (path, ref string)) UploadOption
- func WithUploadStartedCallback(cb func(files_sdk.FileUploadPart)) UploadOption
- type UploadResumable
- type UploadStatus
- func (u *UploadStatus) EndedAt() time.Time
- func (u *UploadStatus) Err() error
- func (u *UploadStatus) File() files_sdk.File
- func (u *UploadStatus) Id() string
- func (u *UploadStatus) IncrementTransferBytes(b int64)
- func (u *UploadStatus) Job() *Job
- func (u *UploadStatus) LocalPath() string
- func (u *UploadStatus) RecentError() error
- func (u *UploadStatus) RemotePath() string
- func (u *UploadStatus) SetStatus(s status.Status, err error)
- func (u *UploadStatus) SetUploadedBytes(b int64)
- func (u *UploadStatus) Size() int64
- func (u *UploadStatus) StartedAt() time.Time
- func (u *UploadStatus) Status() status.Status
- func (u *UploadStatus) StatusChanges() status.Changes
- func (u *UploadStatus) TransferBytes() int64
- type Uploader
- type UploaderParams
- type WritableFile
Constants ¶
const ( DownloadPartChunkSize = int64(1024 * 1024 * 5) DownloadPartLimit = 15 )
const ( RetryAll = RetryPolicyType("RetryAll") RetryUnfinished = RetryPolicyType("RetryUnfinished") )
const TempDownloadExtension = "download"
Variables ¶
var UntrustedSizeRangeRequestSizeExpectedReceived = fmt.Errorf("received size did not match server expected size")
var UntrustedSizeRangeRequestSizeSentLessThanExpected = fmt.Errorf("server send less than expected")
var UntrustedSizeRangeRequestSizeSentMoreThanExpected = fmt.Errorf("server send more than expected")
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 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 Download ¶
func Download(params files_sdk.FileDownloadParams, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)
func Find ¶
func Find(params files_sdk.FileFindParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)
func Move ¶
func Move(params files_sdk.FileMoveParams, opts ...files_sdk.RequestResponseOption) (fileAction files_sdk.FileAction, err error)
func RetryByPolicy ¶
func RetryByPolicy(ctx context.Context, job *Job, policy RetryPolicy, signalEvents bool)
func RetryByStatus ¶
func SetJobParams ¶
func Update ¶
func Update(params files_sdk.FileUpdateParams, opts ...files_sdk.RequestResponseOption) (file files_sdk.File, err error)
func UpdateWithMap ¶
func WaitTellFinished ¶
Types ¶
type ByteOffset ¶
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 ¶
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) 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 (c *Client) CreateFolder(params files_sdk.FolderCreateParams, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)
func (*Client) Delete ¶
func (c *Client) Delete(params files_sdk.FileDeleteParams, opts ...files_sdk.RequestResponseOption) (err error)
func (*Client) Download ¶
func (c *Client) Download(params files_sdk.FileDownloadParams, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)
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 (c *Client) DownloadUri(params files_sdk.FileDownloadParams, opts ...files_sdk.RequestResponseOption) (files_sdk.File, error)
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) ListFor ¶
func (c *Client) ListFor(params files_sdk.FolderListForParams, opts ...files_sdk.RequestResponseOption) (Iter, error)
func (*Client) ListForRecursive ¶
func (c *Client) ListForRecursive(params files_sdk.FolderListForParams, opts ...files_sdk.RequestResponseOption) (files_sdk.TypedIterI[RecursiveItem], error)
func (*Client) Move ¶
func (c *Client) Move(params files_sdk.FileMoveParams, 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 (*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) UploadWithResume ¶
func (c *Client) UploadWithResume(opts ...UploadOption) (UploadResumable, error)
func (*Client) Uploader ¶
func (c *Client) Uploader(params UploaderParams, opts ...files_sdk.RequestResponseOption) *Job
type DeleteEmptySourceFolders ¶ added in v3.2.8
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
func (ad DeleteEmptySourceFolders) Call(f Job, opts ...files_sdk.RequestResponseOption) (status.Log, error)
type DeleteSource ¶
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 ¶
func (ad DeleteSource) Call(f JobFile, opts ...files_sdk.RequestResponseOption) (status.Log, error)
type DirEntryError ¶
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) *DownloadParts
type DownloadStatus ¶
type DownloadStatus struct {
fs.FS
fs.FileInfo
DownloadedBytes int64
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) 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) Valid ¶
func (d DownloadUri) Valid(within time.Duration) (s DownloadUriValid, valid bool, err error)
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
RetryPolicy
*manager.Manager
EventsReporter
DryRun bool
// contains filtered or unexported fields
}
type EventsReporter ¶
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) 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) PathSeparator ¶
func (*FS) WithContext ¶
type File ¶
type File struct {
*files_sdk.File
*FS
ReadCloser lib.AtomicValue[io.ReadCloser]
MaxConnections int
SizeTrust
// contains filtered or unexported fields
}
func (*File) ReaderRange ¶
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 Iter ¶
func (Iter) LoadResource ¶
func (i Iter) LoadResource(identifier interface{}, opts ...files_sdk.RequestResponseOption) (interface{}, error)
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
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) ClearCalled ¶
func (r *Job) ClearCalled()
func (*Job) ClearStatuses ¶
func (*Job) ElapsedTime ¶
func (*Job) EnqueueNext ¶
func (*Job) FinalTransferRate ¶
func (*Job) RegisterFileEvent ¶
func (*Job) SetEventsReporter ¶
func (r *Job) SetEventsReporter(e EventsReporter)
func (*Job) SetManager ¶
func (*Job) StatusFromError ¶
func (*Job) TransferRate ¶
func (*Job) UpdateStatusWithBytes ¶
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"`
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 ¶
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 ¶
MoveSource files after a sync
job.RegisterFileEvent(func(file status.File) {
log, err := file.MoveSource{Direction: f.Direction, Config: config}.Call(ctx, f)
}, status.Complete, status.Skipped)
func (MoveSource) Call ¶
func (am MoveSource) Call(f JobFile, opts ...files_sdk.RequestResponseOption) (status.Log, error)
type Part ¶
type Part struct {
OffSet
context.Context
context.CancelFunc
*sync.RWMutex
files_sdk.FileUploadPart
ProxyReader
// contains filtered or unexported fields
}
func (*Part) Successful ¶
type PartRunnerReturn ¶
type PartRunnerReturn int
type PossibleSize ¶
type PossibleSize interface {
PossibleSize() int64
}
type ProxyReader ¶
type ProxyReader interface {
io.ReadCloser
Len() int
BytesRead() int64
Rewind() bool
}
type ProxyReaderAt ¶
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) Rewind ¶
func (x *ProxyReaderAt) Rewind() bool
type ReadAtLeastWrapper ¶
type ReadAtLeastWrapper struct {
io.ReadCloser
io.Reader
}
func (ReadAtLeastWrapper) Close ¶
func (r ReadAtLeastWrapper) Close() error
type ReadDirFile ¶
type ReadDirFile struct {
*File
// contains filtered or unexported fields
}
type ReadWrapper ¶
type ReadWrapper struct {
io.ReadCloser
// contains filtered or unexported fields
}
type ReaderCloserDownloadStatus ¶
type ReaderCloserDownloadStatus struct {
*ReadWrapper
UntrustedSizeRangeRequestSize
// contains filtered or unexported fields
}
func (ReaderCloserDownloadStatus) Close ¶
func (r ReaderCloserDownloadStatus) Close() error
type ReaderRange ¶
type RecursiveItem ¶
func (RecursiveItem) Err ¶
func (r RecursiveItem) Err() error
type RetryPolicy ¶
type RetryPolicy struct {
Type RetryPolicyType
RetryCount int
Backoff int
}
type RetryPolicyType ¶
type RetryPolicyType string
type Subscriptions ¶
type UntrustedSize ¶
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 UploadWithManager ¶
func UploadWithManager(manager lib.ConcurrencyManagerWithSubWorker) 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 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
}
type UploadStatus ¶
type UploadStatus struct {
Sync bool
NoOverwrite bool
Uploader
UploadResumable
Mutex *sync.RWMutex
status.Changes
// contains filtered or unexported fields
}
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) 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 Uploader ¶
type Uploader interface {
UploadWithResume(...UploadOption) (UploadResumable, error)
Find(files_sdk.FileFindParams, ...files_sdk.RequestResponseOption) (files_sdk.File, error)
CreateFolder(files_sdk.FolderCreateParams, ...files_sdk.RequestResponseOption) (files_sdk.File, error)
}
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
// RetryPolicy config for retrying errored uploads.
RetryPolicy
// EventsReporter log file events
EventsReporter
// Manager limit concurrency
*manager.Manager
*Job
PreserveTimes bool
// contains filtered or unexported fields
}