tfile

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: AGPL-3.0 Imports: 22 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, downloaded, total int64)

func (*Progress) OnStart

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

type ProgressOption

type ProgressOption func(*Progress)

type ProgressTracker

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

func NewProgressTrack

func NewProgressTrack(
	messageID int,
	chatID int64,
	opts ...ProgressOption,
) ProgressTracker

type ProgressWriter

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

func (*ProgressWriter) Write

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

type ProgressWriterAt

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

func (*ProgressWriterAt) WriteAt

func (w *ProgressWriterAt) WriteAt(p []byte, off int64) (int, error)

type Task

type Task struct {
	ID       string
	Ctx      context.Context
	File     tfile.TGFile
	Storage  storage.Storage
	Path     string
	Progress ProgressTracker
	// contains filtered or unexported fields
}

func NewTGFileTask

func NewTGFileTask(
	id string,
	ctx context.Context,
	file tfile.TGFile,
	stor storage.Storage,
	path string,
	progress ProgressTracker,
) (*Task, error)

func (*Task) Execute

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

func (*Task) FileName

func (t *Task) FileName() string

func (*Task) FileSize

func (t *Task) FileSize() int64

func (*Task) StorageName

func (t *Task) StorageName() string

func (*Task) StoragePath

func (t *Task) StoragePath() string

func (*Task) TaskID

func (t *Task) TaskID() string

func (*Task) Type

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

type TaskInfo

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

Jump to

Keyboard shortcuts

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