batchtfile

package
v0.38.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2025 License: AGPL-3.0 Imports: 28 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
	Ctx          context.Context
	Elems        []TaskElement
	Progress     ProgressTracker
	IgnoreErrors bool // if true, errors during processing will be ignored
	// contains filtered or unexported fields
}

func NewBatchTGFileTask

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

func (*Task) Count

func (t *Task) Count() int

func (*Task) Downloaded

func (t *Task) Downloaded() int64

func (*Task) Execute

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

func (*Task) Processing

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

func (*Task) TaskID

func (t *Task) TaskID() string

func (*Task) TotalSize

func (t *Task) TotalSize() int64

func (*Task) Type

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

type TaskElement

type TaskElement struct {
	ID      string
	Storage storage.Storage
	Path    string
	File    tfile.TGFile
	// contains filtered or unexported fields
}

func NewTaskElement

func NewTaskElement(
	stor storage.Storage,
	path string,
	file tfile.TGFile,
) (*TaskElement, error)

func (*TaskElement) FileName

func (e *TaskElement) FileName() string

func (*TaskElement) FileSize

func (e *TaskElement) FileSize() int64

func (*TaskElement) StorageName

func (e *TaskElement) StorageName() string

func (*TaskElement) StoragePath

func (e *TaskElement) StoragePath() string

type TaskElementInfo

type TaskElementInfo interface {
	FileName() string
	FileSize() int64
	StoragePath() string
	StorageName() string
}

type TaskInfo

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

Jump to

Keyboard shortcuts

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