storage

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// S3Prefix defines that prefix of url is s3
	S3Prefix = "s3"
	// LocalPrefix defines that prefix of url is local host
	LocalPrefix = ""
)
View Source
const MaxTimeOut = 100 * time.Second

MaxTimeOut is max deadline time of client working

Variables

This section is empty.

Functions

This section is empty.

Types

type MinioClient

type MinioClient struct {
	Client *minio.Client
}

MinioClient defines a minio client

type Storage

type Storage struct {
	MinioClient    *MinioClient
	IsLocalStorage bool
}

func (*Storage) CheckURL

func (s *Storage) CheckURL(objectURL string) (string, error)

CheckURL checks prefix of the url

func (*Storage) CopyFile

func (s *Storage) CopyFile(srcURL string, objectURL string) error

CopyFile copy the file to another

func (*Storage) Download

func (s *Storage) Download(objectURL string, localPath string) (string, error)

Download downloads the file to the local host

func (*Storage) IsLocalURL

func (s *Storage) IsLocalURL(srcURL string) (bool, error)

IsLocalURL checks whether the url is local url

func (*Storage) SetCredential

func (s *Storage) SetCredential(credential string) error

SetCredential sets credential of the storage service

func (*Storage) Upload

func (s *Storage) Upload(localPath string, objectURL string) error

Upload uploads the src url to the object url (e.g., "s3")

Jump to

Keyboard shortcuts

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