Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, serverAddr string, concurrency int32, name, store, token string, isPermanent bool, provider *string, region *string, noBare ...bool) error

/ client launcher

Types

type DownloadFailure

type DownloadFailure struct {
	Task    *pb.Task
	Message string
}

DownloadFailure carries a unified failure notification from the downloader to a single status update point in the client loop.

type DownloadManager

type DownloadManager struct {
	ResourceDownloads map[string][]*pb.Task   // SourcePath → Tasks waiting
	ResourceMemory    map[string]FileMetadata // SourcePath → Metadata

	FileQueue       chan *FileTransfer    // Limited queue (maxDownloads=20)
	TaskQueue       chan *pb.Task         // Unlimited queue (tasks waiting for download)
	CompletionQueue chan *FileMetadata    // Completed downloads
	ExecQueue       chan *pb.Task         // Tasks ready for execution
	FailedQueue     chan *DownloadFailure // Tasks that failed during downloads (centralized reporting)
	Store           string

	// Tracks tasks currently being scheduled for downloads to ensure idempotency at the boundary.
	EnqueuedTasks map[int32]bool
	// Per-task chrono map for download durations
	DownloadStart map[int32]time.Time
	// Per-task pending set for download items
	TaskPending   map[int32]map[string]bool // Task ID → set of pending item keys (I:input, R:resource, D:docker)
	RcloneRemotes *pb.RcloneRemotes
	// contains filtered or unexported fields
}

DownloadManager manages task downloads.

func NewDownloadManager

func NewDownloadManager(store string, reporter *event.Reporter, rcloneRemotes *pb.RcloneRemotes) *DownloadManager

NewDownloadManager initializes the download manager.

func RunDownloader

func RunDownloader(store string, reporter *event.Reporter, rcloneRemotes *pb.RcloneRemotes) *DownloadManager

run downloader

func (*DownloadManager) ProcessDownloads

func (dm *DownloadManager) ProcessDownloads()

ProcessDownloads manages incoming tasks and processes downloads.

func (*DownloadManager) StartDownloadWorkers

func (dm *DownloadManager) StartDownloadWorkers()

StartDownloadWorkers launches download workers.

type FileMetadata

type FileMetadata struct {
	TaskId     int32
	Task       *pb.Task
	SourcePath string
	FilePath   string
	FileType   FileType
	Size       int64
	Date       time.Time
	MD5        string
	Success    bool // true if download succeeded
}

ResourceMetadata stores metadata for downloaded resources.

type FileTransfer

type FileTransfer struct {
	TaskId     int32
	Task       *pb.Task
	FileType   FileType
	SourcePath string
	TargetPath string
}

type FileType

type FileType int

FileTransfer represents a download task.

const (
	InputFile FileType = iota
	ResourceFile
	DockerImage
)

type SyncCounter

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

func (*SyncCounter) Decrement

func (sc *SyncCounter) Decrement(taskID int32) (int, bool)

func (*SyncCounter) Set

func (sc *SyncCounter) Set(taskID int32, count int)

type UploadFailure

type UploadFailure struct {
	Task    *pb.Task
	Message string
}

UploadFailure carries a unified failure notification from the uploader to a single status update point in the client loop.

type UploadFile

type UploadFile struct {
	Task       *pb.Task
	SourcePath string
	TargetPath string
}

type UploadManager

type UploadManager struct {
	UploadQueue chan *UploadFile
	Completion  chan *pb.Task
	FailedQueue chan *UploadFailure
	Store       string
	Client      pb.TaskQueueClient

	RcloneRemotes *pb.RcloneRemotes
	// contains filtered or unexported fields
}

func NewUploadManager

func NewUploadManager(store string, client pb.TaskQueueClient, reporter *event.Reporter, rcloneRemotes *pb.RcloneRemotes) *UploadManager

func RunUploader

func RunUploader(store string, client pb.TaskQueueClient, activeTasks *sync.Map, reporter *event.Reporter, rcloneRemotes *pb.RcloneRemotes) *UploadManager

RunUploader starts upload workers and returns the manager.

func (*UploadManager) EnqueueTaskOutput

func (um *UploadManager) EnqueueTaskOutput(task *pb.Task)

func (*UploadManager) StartUploadWorkers

func (um *UploadManager) StartUploadWorkers(activeTasks *sync.Map)

type WorkerConfig

type WorkerConfig struct {
	WorkerId    int32
	ServerAddr  string
	Concurrency int32
	Name        string
	Store       string
	Token       string
	IsPermanent bool
	Provider    *string
	Region      *string
	NoBare      bool // reject bare tasks
}

WorkerConfig holds worker settings from CLI args.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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