transfer

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Progress

type Progress struct {
	MessageID int
	ChatID    int64
	// contains filtered or unexported fields
}

func (*Progress) OnDone

func (p *Progress) OnDone(ctx context.Context, info TaskInfo, err error)

func (*Progress) OnProgress

func (p *Progress) OnProgress(ctx context.Context, info TaskInfo)

func (*Progress) OnStart

func (p *Progress) OnStart(ctx context.Context, info TaskInfo)

type ProgressTracker

type ProgressTracker interface {
	OnStart(ctx context.Context, info TaskInfo)
	OnProgress(ctx context.Context, info TaskInfo)
	OnDone(ctx context.Context, info TaskInfo, err error)
}

func NewProgressTracker

func NewProgressTracker(messageID int, chatID int64) ProgressTracker

type Task

type Task struct {
	ID string

	Progress     ProgressTracker
	IgnoreErrors bool
	// contains filtered or unexported fields
}

func NewTransferTask

func NewTransferTask(
	id string,
	ctx context.Context,
	elems []TaskElement,
	progress ProgressTracker,
	ignoreErrors bool,
) *Task

func (*Task) Count

func (t *Task) Count() int

func (*Task) Execute

func (t *Task) Execute(ctx context.Context) error

Execute implements core.Executable.

func (*Task) FailedFiles

func (t *Task) FailedFiles() []string

func (*Task) Processing

func (t *Task) Processing() []TaskElementInfo

func (*Task) TaskID

func (t *Task) TaskID() string

TaskID implements core.Executable.

func (*Task) Title

func (t *Task) Title() string

Title implements core.Executable.

func (*Task) TotalSize

func (t *Task) TotalSize() int64

func (*Task) Type

func (t *Task) Type() tasktype.TaskType

Type implements core.Executable.

func (*Task) Uploaded

func (t *Task) Uploaded() int64

type TaskElement

type TaskElement struct {
	ID            string
	SourceStorage storage.Storage
	SourcePath    string
	FileInfo      storagetypes.FileInfo
	TargetStorage storage.Storage
	TargetPath    string
}

func NewTaskElement

func NewTaskElement(
	sourceStorage storage.Storage,
	fileInfo storagetypes.FileInfo,
	targetStorage storage.Storage,
	targetPath string,
) *TaskElement

func (*TaskElement) FileName

func (e *TaskElement) FileName() string

func (*TaskElement) FileSize

func (e *TaskElement) FileSize() int64

func (*TaskElement) GetSourcePath

func (e *TaskElement) GetSourcePath() string

func (*TaskElement) SourceStorageName

func (e *TaskElement) SourceStorageName() string

type TaskElementInfo

type TaskElementInfo interface {
	FileName() string
	FileSize() int64
	GetSourcePath() string
	SourceStorageName() string
}

type TaskInfo

type TaskInfo interface {
	TaskID() string
	TotalSize() int64
	Uploaded() int64
	Count() int
	Processing() []TaskElementInfo
	FailedFiles() []string
}

Jump to

Keyboard shortcuts

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