oss

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OSS_TYPE_LOCAL          = "local"
	OSS_TYPE_S3             = "aws_s3"
	OSS_TYPE_TENCENT_COS    = "tencent_cos"
	OSS_TYPE_AZURE_BLOB     = "azure_blob"
	OSS_TYPE_GCS            = "gcs"
	OSS_TYPE_ALIYUN_OSS     = "aliyun_oss"
	OSS_TYPE_HUAWEI_OBS     = "huawei_obs"
	OSS_TYPE_VOLCENGINE_TOS = "volcengine_tos"
)

OSS supports different types of object storage services such as local file system, AWS S3, and Tencent COS. The interface defines methods for saving, loading, checking existence,

Variables

View Source
var (
	ErrProviderNotFound = NewCloudKitError("provider not found", "")
	ErrArgumentInvalid  = NewCloudKitError("argument invalid", "")
	ErrProviderInit     = NewCloudKitError("provider init error", "")
)

Functions

This section is empty.

Types

type AliyunOSS

type AliyunOSS struct {
	Region      string
	Endpoint    string
	AccessKey   string
	SecretKey   string
	AuthVersion string
	Path        string
	Bucket      string
	CloudBoxId  string
}

func (*AliyunOSS) Validate

func (a *AliyunOSS) Validate() error

type AzureBlob

type AzureBlob struct {
	ConnectionString string
	ContainerName    string
}

func (*AzureBlob) Validate

func (a *AzureBlob) Validate() error

type CloudKitError

type CloudKitError struct {
	Reason string
	Detail string
	Err    error
}

func NewCloudKitError

func NewCloudKitError(reason string, detail string) *CloudKitError

func (*CloudKitError) Error

func (c *CloudKitError) Error() string

func (*CloudKitError) WithDetail

func (c *CloudKitError) WithDetail(detail string) *CloudKitError

func (*CloudKitError) WithError

func (c *CloudKitError) WithError(err error) *CloudKitError

type GoogleCloudStorage

type GoogleCloudStorage struct {
	Bucket         string
	CredentialsB64 string
}

func (*GoogleCloudStorage) Validate

func (g *GoogleCloudStorage) Validate() error

type HuaweiOBS

type HuaweiOBS struct {
	Bucket    string
	AccessKey string
	SecretKey string
	Server    string
	PathStyle bool
}

func (*HuaweiOBS) Validate

func (h *HuaweiOBS) Validate() error

type Local

type Local struct {
	Path string
}

func (*Local) Validate

func (l *Local) Validate() error

type OSS

type OSS interface {
	// Save saves data into path key
	Save(key string, data []byte) error
	// Load loads data from path key
	Load(key string) ([]byte, error)
	// Exists checks if the data exists in the path key
	Exists(key string) (bool, error)
	// State gets the state of the data in the path key
	State(key string) (OSSState, error)
	// List lists all the data with the given prefix, and all the paths are absolute paths
	List(prefix string) ([]OSSPath, error)
	// Delete deletes the data in the path key
	Delete(key string) error
	// Type returns the type of the storage
	// For example: local, aws_s3, tencent_cos
	Type() string
}

type OSSArgs

type OSSArgs struct {
	S3                 *S3
	Local              *Local
	AzureBlob          *AzureBlob
	AliyunOSS          *AliyunOSS
	TencentCOS         *TencentCOS
	GoogleCloudStorage *GoogleCloudStorage
	HuaweiOBS          *HuaweiOBS
	VolcengineTOS      *VolcengineTOS
}

type OSSPath

type OSSPath struct {
	Path  string
	IsDir bool
}

type OSSState

type OSSState struct {
	Size         int64
	LastModified time.Time
}

type S3

type S3 struct {
	UseAws           bool
	Endpoint         string
	UsePathStyle     bool
	AccessKey        string
	SecretKey        string
	Bucket           string
	Region           string
	UseIamRole       bool
	SignatureVersion string
}

func (*S3) Validate

func (s *S3) Validate() error

type TencentCOS

type TencentCOS struct {
	Region    string
	SecretID  string
	SecretKey string
	Bucket    string
	Endpoint  string
}

func (*TencentCOS) Validate

func (t *TencentCOS) Validate() error

type VolcengineTOS

type VolcengineTOS struct {
	Region    string
	Endpoint  string
	AccessKey string
	SecretKey string
	Bucket    string
}

func (*VolcengineTOS) Validate

func (t *VolcengineTOS) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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