store

package
v0.0.0-...-a6952bb Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultS3Region string = "us-east-1"

Variables

This section is empty.

Functions

func ReadUrlData

func ReadUrlData(urlType UrlType, urlStr string) ([]byte, error)

Types

type CephClient

type CephClient struct {
	*s3.S3
	// contains filtered or unexported fields
}

func NewCephClient

func NewCephClient(cfg *CephConfig) (*CephClient, error)

func (*CephClient) CheckBucketExist

func (cephClient *CephClient) CheckBucketExist(bucketName string) (bool, error)

func (*CephClient) CreateBucket

func (cephClient *CephClient) CreateBucket(bucketName string) error

func (*CephClient) GetObjectUrl

func (cephClient *CephClient) GetObjectUrl(bucketName, objectName string) (string, UrlType, error)

func (*CephClient) ListBuckets

func (cephClient *CephClient) ListBuckets() (*ListBucketsResult, error)

func (*CephClient) ListObjects

func (cephClient *CephClient) ListObjects(bucketName, marker, prefix string) (*ListObjectsResult, error)

func (*CephClient) UploadFile

func (cephClient *CephClient) UploadFile(urlType UrlType, urlStr, dstBucketName, dstObjectName string) error

type CephConfig

type CephConfig struct {
	AccessKey string
	SecretKey string
	EndPoint  string
}

type ListBucketsResult

type ListBucketsResult struct {
	BucketNames []string
}

type ListObjectsResult

type ListObjectsResult struct {
	ObjectsName []string
	Suspend     *bool
	NextMarker  *string
}

type LocalClient

type LocalClient struct {
}

func NewLocalClient

func NewLocalClient() (*LocalClient, error)

func (*LocalClient) CheckBucketExist

func (localClient *LocalClient) CheckBucketExist(dirName string) (bool, error)

func (*LocalClient) CreateBucket

func (localClient *LocalClient) CreateBucket(dirName string) error

func (*LocalClient) GetObjectUrl

func (localClient *LocalClient) GetObjectUrl(dirName, objectName string) (string, UrlType, error)

func (*LocalClient) ListBuckets

func (localClient *LocalClient) ListBuckets() (*ListBucketsResult, error)

func (*LocalClient) ListObjects

func (localClient *LocalClient) ListObjects(dirName, marker, prefix string) (*ListObjectsResult, error)

func (*LocalClient) UploadFile

func (localClient *LocalClient) UploadFile(urlType UrlType, urlStr, dstBucketName, dstObjectName string) error

type OssClient

type OssClient struct {
	*oss.Client
}

func NewOssClient

func NewOssClient(cfg *OssConfig) (*OssClient, error)

func (*OssClient) CheckBucketExist

func (ossClient *OssClient) CheckBucketExist(bucketName string) (bool, error)

func (*OssClient) CreateBucket

func (ossClient *OssClient) CreateBucket(bucketName string) error

func (*OssClient) GetObjectUrl

func (ossClient *OssClient) GetObjectUrl(bucketName, objectName string) (string, UrlType, error)

func (*OssClient) ListBuckets

func (ossClient *OssClient) ListBuckets() (*ListBucketsResult, error)

func (*OssClient) ListObjects

func (ossClient *OssClient) ListObjects(bucketName, marker, prefix string) (*ListObjectsResult, error)

func (*OssClient) UploadFile

func (ossClient *OssClient) UploadFile(urlType UrlType, urlStr, dstBucketName, dstObjectName string) error

type OssConfig

type OssConfig struct {
	AccessID  string
	AccessKey string
	EndPoint  string
}

type Store

type Store interface {
	ListBuckets() (*ListBucketsResult, error)
	CheckBucketExist(bucketName string) (bool, error)
	CreateBucket(bucketName string) error
	UploadFile(urlType UrlType, urlStr, dstBucketName, dstObjectName string) error
	GetObjectUrl(bucketName, objectName string) (string, UrlType, error)
	ListObjects(bucketName, marker, prefix string) (*ListObjectsResult, error)
}

type UrlType

type UrlType string
const (
	HttpUrl  UrlType = "http"
	LocalUrl UrlType = "file"
)

Jump to

Keyboard shortcuts

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