cloud

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFile

func GetFile(filepath string, url string) error

GetFile downloads a file from the given url and stores it in filepath.

func GetStatus

func GetStatus(url string) (int, error)

GetStatus get the http status of an url.

func PutFile

func PutFile(filepath string, url string) (*http.Response, error)

PutFile puts the local file specified in filepath to the remote url via http PUT.

func PutS3

func PutS3(localPath, url string) error

PutS3 is a helper func to put to s3.

Types

type ImageRegUploader

type ImageRegUploader struct {
	Method  string
	Bucket  string
	BaseURL string
	Images  <-chan db.Image
	Done    <-chan struct{}
	Result  chan<- db.Image
	Verbose bool
	// contains filtered or unexported fields
}

ImageRegUploader coordinates image registration and uploading concurrently.

func (*ImageRegUploader) Digest

func (iru *ImageRegUploader) Digest()

Digest registers and uploads each image from Images and send back the result to Result until either Images or Done is closed.

func (*ImageRegUploader) Run

func (iru *ImageRegUploader) Run(n int) int

Run starts n number of goroutines to digest each image. If n is not positive, it will be set to number of CPU cores. Return n.

func (*ImageRegUploader) WithOSSUploader

func (iru *ImageRegUploader) WithOSSUploader(pid string) error

WithOSSUploader setups an OSS uploader for current pid and bucket.

type ImageStateChecker

type ImageStateChecker struct {
	Images  <-chan db.Image
	Done    <-chan struct{}
	Result  chan<- db.Image
	Timeout time.Duration
}

ImageStateChecker check the image states of all images within timeout.

func (*ImageStateChecker) Digest

func (isc *ImageStateChecker) Digest()

Digest checks state of each image from Images and send back the result to Result until either Images or Done is closed.

func (*ImageStateChecker) Run

func (isc *ImageStateChecker) Run(n int) int

Run starts n number of goroutines to digest each image. If n is not positive, it will be set to number of CPU cores. Return n.

type MetaFileRegUploader

type MetaFileRegUploader struct {
	Method    string
	PID       string
	MID       string
	MetaPath  string
	Filename  string
	DirectURL string
	Bucket    string
	Timeout   int
	Verbose   bool
	// contains filtered or unexported fields
}

MetaFileRegUploader coordinates single meta file registration and uploading.

func (*MetaFileRegUploader) Done

func (mru *MetaFileRegUploader) Done() error

Done cleanups this uploader if user wants to terminate early.

func (*MetaFileRegUploader) Run

func (mru *MetaFileRegUploader) Run() (string, error)

Run starts the registration and uploading process. Return the state of imported meta file.

type ModelRegUploader

type ModelRegUploader struct {
	Method       string
	PID          string
	ModelPath    string
	Filename     string
	DirectURL    string
	Bucket       string
	MultipartDir string // dir storing the 7zip multiparts
	Timeout      int
	Verbose      bool
	// contains filtered or unexported fields
}

ModelRegUploader coordinates model registration and uploading.

func (*ModelRegUploader) Done

func (mru *ModelRegUploader) Done()

Done cleanups this uploader if user wants to terminate early.

func (*ModelRegUploader) Run

func (mru *ModelRegUploader) Run() (string, error)

Run starts the registration and uploading process. Return the state of imported model.

type OSSUploader

type OSSUploader struct {
	PID        string
	RefreshSTS func() (*types.STS, error)
	// contains filtered or unexported fields
}

OSSUploader takes care of uploading files to a specific loccation and refresh its credentials.

func NewOSSUploader

func NewOSSUploader(pid string, refresh func() (*types.STS, error)) (*OSSUploader, error)

NewOSSUploader returns a new OSSUploader.

func (*OSSUploader) PutFile

func (ou *OSSUploader) PutFile(filepath, cloudPath string) error

PutFile puts a file under the project's write-only space in OSS.

func (*OSSUploader) Refresh

func (ou *OSSUploader) Refresh() error

Refresh refreshes its STS token.

Jump to

Keyboard shortcuts

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