file

package
v2.0.90-beta Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: MIT Imports: 27 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RetryAll                    = RetryPolicy("RetryAll")
	RetryUnfinished             = RetryPolicy("RetryUnfinished")
	RetryErroredIfSomeCompleted = RetryPolicy("RetryErroredIfSomeCompleted")
)

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, params files_sdk.FileDeleteParams) error

func Find

func Get

func Get(ctx context.Context, Path string) (files_sdk.File, error)

func RetryByPolicy

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

func RetryByStatus

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

func SetJobParams

func SetJobParams(r *status.Job, d direction.Direction, params interface{})

Types

type Client

type Client struct {
	files_sdk.Config
}

func (*Client) Copy

func (*Client) Create

func (c *Client) Create(ctx context.Context, params files_sdk.FileCreateParams) (files_sdk.File, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, params files_sdk.FileDeleteParams) error

func (*Client) Download

func (c *Client) Download(ctx context.Context, params files_sdk.FileDownloadParams) (files_sdk.File, error)

func (*Client) DownloadRetry

func (c *Client) DownloadRetry(ctx context.Context, job status.Job) *status.Job

func (*Client) DownloadToFile

func (c *Client) DownloadToFile(ctx context.Context, params files_sdk.FileDownloadParams, filePath string) (files_sdk.File, error)

func (*Client) Downloader

func (c *Client) Downloader(ctx context.Context, params DownloaderParams) *status.Job

func (*Client) Find

func (*Client) Get

func (c *Client) Get(ctx context.Context, Path string) (files_sdk.File, error)

func (*Client) ListFor

func (c *Client) ListFor(ctx context.Context, params files_sdk.FolderListForParams) (*folder.Iter, error)

func (*Client) ListForRecursive

func (c *Client) ListForRecursive(ctx context.Context, params files_sdk.FolderListForParams) (lib.IterI, error)

func (*Client) Move

func (*Client) Update

func (c *Client) Update(ctx context.Context, params files_sdk.FileUpdateParams) (files_sdk.File, error)

func (*Client) UploadIO

func (c *Client) UploadIO(parentCtx context.Context, params UploadIOParams) (files_sdk.File, files_sdk.FileUploadPart, Parts, error)

func (*Client) UploadRetry

func (c *Client) UploadRetry(ctx context.Context, job status.Job) *status.Job

func (*Client) Uploader

func (c *Client) Uploader(ctx context.Context, params UploaderParams) *status.Job

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

func (ad DeleteSource) Call(ctx context.Context, f status.File) (status.Log, error)

type DownloadStatus

type DownloadStatus struct {
	DownloadedBytes int64

	Sync bool

	Mutex         *sync.RWMutex
	PreserveTimes bool
	// contains filtered or unexported fields
}

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) Job

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

func (*DownloadStatus) LastByte

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

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) Status

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

func (*DownloadStatus) TransferBytes

func (d *DownloadStatus) TransferBytes() int64

type DownloaderParams

type DownloaderParams struct {
	RemotePath    string
	RemoteFile    files_sdk.File
	LocalPath     string
	Sync          bool
	PreserveTimes bool
	RetryPolicy
	*manager.Manager
	status.EventsReporter
}

type Entity

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

type FS

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

func (FS) Init

func (f FS) Init(config files_sdk.Config) FS

func (*FS) MkdirAll

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

func (FS) Open

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

func (FS) WithContext

func (f FS) WithContext(ctx context.Context) FS

type File

type File struct {
	*files_sdk.File
	FS
	io.ReadCloser
}

func (*File) Close

func (f *File) Close() error

func (File) Info

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

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) (int, error)

func (*File) Reload

func (f *File) Reload() (File, 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)

type Info

type Info struct {
	*files_sdk.File
}

func (Info) IsDir

func (i Info) IsDir() bool

func (Info) ModTime

func (i Info) ModTime() time.Time

func (Info) Mode

func (i Info) Mode() goFs.FileMode

func (Info) Name

func (i Info) Name() string

func (Info) Size

func (i Info) Size() int64

func (Info) Sys

func (i Info) Sys() interface{}

type MoveSource

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

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(ctx context.Context, f status.File) (status.Log, error)

type OffSet

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

type Part

type Part struct {
	OffSet
	files_sdk.EtagsParam
	// contains filtered or unexported fields
}

func (*Part) Clear

func (p *Part) Clear()

func (*Part) Successful

func (p *Part) Successful() bool

func (*Part) Touch

func (p *Part) Touch()

type Parts

type Parts []*Part

func (Parts) SuccessfulBytes

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

type ProxyReader

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

func (*ProxyReader) Close

func (x *ProxyReader) Close() error

func (*ProxyReader) Len

func (x *ProxyReader) Len() int

func (*ProxyReader) Read

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

func (*ProxyReader) Seek

func (x *ProxyReader) Seek(offset int64, whence int) (int64, 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 RetryPolicy

type RetryPolicy string

type UploadIOParams

type UploadIOParams struct {
	Path     string
	Reader   io.ReaderAt
	Size     int64
	Progress func(int64)
	Manager  goccm.ConcurrencyManager

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

func (UploadIOParams) ProvidedMtime

func (u UploadIOParams) ProvidedMtime() time.Time

type UploadStatus

type UploadStatus struct {
	Sync          bool
	PreserveTimes bool

	Uploader
	Parts
	files_sdk.FileUploadPart
	Mutex *sync.RWMutex
	// contains filtered or unexported fields
}

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) Job

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

func (*UploadStatus) LastByte

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

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) Status

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

func (*UploadStatus) TransferBytes

func (u *UploadStatus) TransferBytes() int64

type UploaderParams

type UploaderParams struct {
	Ignore []string
	*status.Job
	Sync          bool
	LocalPath     string
	RemotePath    string
	PreserveTimes bool
	RetryPolicy
	status.EventsReporter
	*manager.Manager
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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