storage

package
v0.0.79 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GoogleBucketNamePrefix = "project-hub-"
	GoogleProjectID        = "tensorleap-ops3"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileMeta

type FileMeta struct {
	Name        string
	Size        int64
	CreatedTime time.Time
	UpdatedTime time.Time
}

type GoogleBucketClient

type GoogleBucketClient struct {
	Name string
	// contains filtered or unexported fields
}

func NewGoogleBucketClient

func NewGoogleBucketClient(bucket *storage.BucketHandle, name string) *GoogleBucketClient

func (*GoogleBucketClient) CheckIfFileExists

func (c *GoogleBucketClient) CheckIfFileExists(fileName string) (bool, error)

func (*GoogleBucketClient) CreateSignedUrl added in v0.0.45

func (c *GoogleBucketClient) CreateSignedUrl(fileName string, method string, expire time.Time) (string, error)

func (*GoogleBucketClient) DeleteFile

func (c *GoogleBucketClient) DeleteFile(fileName string) error

func (*GoogleBucketClient) DeleteFilesInDirectory

func (c *GoogleBucketClient) DeleteFilesInDirectory(directoryPath string) (bool, error)

func (*GoogleBucketClient) DownloadFile

func (c *GoogleBucketClient) DownloadFile(fileName string, destFileName string) error

func (*GoogleBucketClient) GetFileBuffer

func (c *GoogleBucketClient) GetFileBuffer(fileName string) ([]byte, error)

func (*GoogleBucketClient) GetFileMeta

func (c *GoogleBucketClient) GetFileMeta(fileName string) (*FileMeta, error)

func (*GoogleBucketClient) ListDirectoryObjects

func (c *GoogleBucketClient) ListDirectoryObjects(directoryPath string, recursive bool) ([]string, error)

func (*GoogleBucketClient) UploadFile

func (c *GoogleBucketClient) UploadFile(fileName string, content io.Reader, options *UploadOptions) error

func (*GoogleBucketClient) UploadFileBuffer

func (c *GoogleBucketClient) UploadFileBuffer(fileName string, content []byte, options *UploadOptions) error

type StorageClient

type StorageClient interface {
	CheckIfFileExists(fileName string) (bool, error)
	GetFileBuffer(fileName string) ([]byte, error)
	UploadFile(fileName string, content io.Reader, options *UploadOptions) error
	UploadFileBuffer(fileName string, content []byte, options *UploadOptions) error
	DownloadFile(fileName string, destFileName string) error
	GetFileMeta(fileName string) (*FileMeta, error)
	DeleteFile(fileName string) error
	DeleteFilesInDirectory(directoryPath string) (bool, error)
	ListDirectoryObjects(directoryPath string, recursive bool) ([]string, error)
	CreateSignedUrl(fileName, method string, expire time.Time) (string, error)
}

func CreateStorageClient

func CreateStorageClient() (StorageClient, error)

type UploadOptions

type UploadOptions struct {
	NoCache bool
}

Jump to

Keyboard shortcuts

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