Documentation
¶
Index ¶
- func GetFile(filepath string, url string) error
- func GetStatus(url string) (int, error)
- func PutFile(filepath string, url string) (*http.Response, error)
- func PutS3(localPath, url string) error
- type ImageRegUploader
- type ImageStateChecker
- type MetaFileRegUploader
- type ModelRegUploader
- type OSSUploader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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.