asyncdownload

package
v0.0.0-...-7404c28 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package asyncdownload NOTES

Package asyncdownload NOTES

Package asyncdownload NOTES

Index

Constants

View Source
const GB = 1024 * 1024 * 1024

GB is the size of 1GB in bytes

Variables

View Source
var (
	// JobTimeoutSeconds is the timeout seconds for async download job
	JobTimeoutSeconds = 10 * 60
)

Functions

func InitMetric

func InitMetric() *metric

InitMetric init the async doenload related prometheus metrics

Types

type CacheCleaner

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

CacheCleaner scheduled task to clean source file cache dir

func NewCacheCleaner

func NewCacheCleaner(cacaheSizeGB int, cacheRetentionRate float64, mc *metric) *CacheCleaner

NewCacheCleaner create a CacheCleaner

func (*CacheCleaner) Run

func (sfc *CacheCleaner) Run()

Run run a scheduled task

func (*CacheCleaner) Stop

func (sfc *CacheCleaner) Stop()

Stop stop scheduled task

type Scheduler

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

Scheduler scheduled task to process download jobs

func NewScheduler

func NewScheduler(mc *metric, redLock *lock.RedisLock) (*Scheduler, error)

NewScheduler create a async download scheduler

func (*Scheduler) Run

func (a *Scheduler) Run()

Run run a scheduled task

func (*Scheduler) Stop

func (a *Scheduler) Stop()

Stop stop scheduled task

type Service

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

Service defines async download related operations.

func NewService

func NewService(cs *clientset.ClientSet, mc *metric, redLock *lock.RedisLock) (*Service, error)

NewService initialize the async download service instance.

func (*Service) CreateAsyncDownloadTask

func (ad *Service) CreateAsyncDownloadTask(kt *kit.Kit, bizID, appID uint32, filePath, fileName,
	targetAgentID, targetContainerID, targetUser, targetDir, signature string) (string, error)

CreateAsyncDownloadTask creates a new async download task.

func (*Service) GetAsyncDownloadTask

func (ad *Service) GetAsyncDownloadTask(kt *kit.Kit, bizID uint32, taskID string) (
	*types.AsyncDownloadTask, error)

GetAsyncDownloadTask get async download task record.

func (*Service) GetAsyncDownloadTaskStatus

func (ad *Service) GetAsyncDownloadTaskStatus(kt *kit.Kit, bizID uint32, taskID string) (
	string, error)

GetAsyncDownloadTaskStatus get async download task and update it's status. task is in instance level, so do not need to lock it.

Jump to

Keyboard shortcuts

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