storage

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AwsS3

type AwsS3 struct {
	AccessKeyId     string
	SecretAccessKey string
	Region          string
	Bucket          string
	Session         *session.Session
	Service         *s3.S3
}

func (*AwsS3) DeleteOldObjects added in v0.5.0

func (this *AwsS3) DeleteOldObjects() error

func (*AwsS3) Download

func (this *AwsS3) Download(objectName string, filePath string) error

func (*AwsS3) GetTargetObjectName

func (this *AwsS3) GetTargetObjectName(objectKey string) (string, error)

func (*AwsS3) Init

func (this *AwsS3) Init(accessKeyId string, secretAccessKey string, region string, bucket string) error

func (*AwsS3) Upload

func (this *AwsS3) Upload(blobName string, buffer []byte) (string, error)

type AzBlob

type AzBlob struct {
	AccountName         string
	AccountKey          string
	ContainerName       string
	BlobServiceClient   *azblob.Client
	BlobContainerClient *container.Client
}

func (*AzBlob) DeleteOldObjects added in v0.5.0

func (this *AzBlob) DeleteOldObjects() error

func (*AzBlob) Download

func (this *AzBlob) Download(blobName string, filePath string) error

func (*AzBlob) GetTargetObjectName

func (this *AzBlob) GetTargetObjectName(blobName string) (string, error)

func (*AzBlob) Init

func (this *AzBlob) Init(accountName string, accountKey string, containerName string) error

func (*AzBlob) Upload

func (this *AzBlob) Upload(blobName string, buffer []byte) (string, error)

type GcpServiceAccountCreds

type GcpServiceAccountCreds struct {
	Type                    string `json:"type"`
	ProjectID               string `json:"project_id"`
	PrivateKeyID            string `json:"private_key_id"`
	PrivateKey              string `json:"private_key"`
	ClientEmail             string `json:"client_email"`
	ClientID                string `json:"client_id"`
	AuthUri                 string `json:"auth_uri"`
	TokenUri                string `json:"token_uri"`
	AuthProviderX509CertUrl string `json:"auth_provider_x509_cert_url"`
	UniverseDomain          string `json:"universe_domain"`
}

type GcpStorage

type GcpStorage struct {
	Bucket        string
	StorageClient *storage.Client
}

func (*GcpStorage) Close

func (this *GcpStorage) Close()

func (*GcpStorage) DeleteOldObjects added in v0.5.0

func (this *GcpStorage) DeleteOldObjects() error

func (*GcpStorage) GetTargetObjectName

func (this *GcpStorage) GetTargetObjectName(objectName string) (string, error)

func (*GcpStorage) Init

func (this *GcpStorage) Init(bucket, credsPath, projectID, privateKeyId, privateKey, clientEmail, clientID string) error

type LocalStorage added in v0.3.0

type LocalStorage struct {
	LocalPath  string
	ExpiryDays int
}

func (*LocalStorage) DeleteOldObjects added in v0.5.0

func (this *LocalStorage) DeleteOldObjects() error

func (*LocalStorage) Download added in v0.3.0

func (this *LocalStorage) Download(objectName string, filePath string) error

func (*LocalStorage) GetTargetObjectName added in v0.3.0

func (this *LocalStorage) GetTargetObjectName(objectName string) (string, error)

func (*LocalStorage) Init added in v0.3.0

func (this *LocalStorage) Init(localPath string, expiryDays int) error

func (*LocalStorage) Upload added in v0.3.0

func (this *LocalStorage) Upload(objectName string, buffer []byte) (string, error)

type Storage

type Storage interface {
	Upload(string, []byte) (string, error)
	Download(string, string) error
	GetTargetObjectName(string) (string, error)
	DeleteOldObjects() error
}

Jump to

Keyboard shortcuts

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