storages

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultWorkspace = "default"
)

Variables

View Source
var (
	ErrWorkspaceNotExist     = errors.New("workspace does not exist")
	ErrWorkspaceAlreadyExist = errors.New("workspace has already existed")
)

Functions

func GenGenericOssWorkspacePrefixKey

func GenGenericOssWorkspacePrefixKey(prefix string) string

GenGenericOssWorkspacePrefixKey generates generic oss workspace prefix key, which is use for OssStorage and S3Storage.

func GenWorkspaceDirPath

func GenWorkspaceDirPath(dir string) string

GenWorkspaceDirPath generates the workspace directory path, which is used for LocalStorage.

Types

type LocalStorage

type LocalStorage struct {
	// contains filtered or unexported fields
}

LocalStorage is an implementation of workspace.Storage which uses local filesystem as storage.

func NewLocalStorage

func NewLocalStorage(path string) (*LocalStorage, error)

NewLocalStorage news local workspace storage and init default workspace.

func (*LocalStorage) Create

func (s *LocalStorage) Create(ws *v1.Workspace) error

func (*LocalStorage) Delete

func (s *LocalStorage) Delete(name string) error

func (*LocalStorage) Get

func (s *LocalStorage) Get(name string) (*v1.Workspace, error)

func (*LocalStorage) GetCurrent

func (s *LocalStorage) GetCurrent() (string, error)

func (*LocalStorage) GetNames

func (s *LocalStorage) GetNames() ([]string, error)

func (*LocalStorage) SetCurrent

func (s *LocalStorage) SetCurrent(name string) error

func (*LocalStorage) Update

func (s *LocalStorage) Update(ws *v1.Workspace) error

type OssStorage

type OssStorage struct {
	// contains filtered or unexported fields
}

OssStorage is an implementation of workspace.Storage which uses oss as storage.

func NewOssStorage

func NewOssStorage(bucket *oss.Bucket, prefix string) (*OssStorage, error)

NewOssStorage news oss workspace storage and init default workspace.

func (*OssStorage) Create

func (s *OssStorage) Create(ws *v1.Workspace) error

func (*OssStorage) Delete

func (s *OssStorage) Delete(name string) error

func (*OssStorage) Get

func (s *OssStorage) Get(name string) (*v1.Workspace, error)

func (*OssStorage) GetCurrent

func (s *OssStorage) GetCurrent() (string, error)

func (*OssStorage) GetNames

func (s *OssStorage) GetNames() ([]string, error)

func (*OssStorage) SetCurrent

func (s *OssStorage) SetCurrent(name string) error

func (*OssStorage) Update

func (s *OssStorage) Update(ws *v1.Workspace) error

type S3Storage

type S3Storage struct {
	// contains filtered or unexported fields
}

S3Storage is an implementation of workspace.Storage which uses s3 as storage.

func NewS3Storage

func NewS3Storage(s3 *s3.S3, bucket, prefix string) (*S3Storage, error)

NewS3Storage news s3 workspace storage and init default workspace.

func (*S3Storage) Create

func (s *S3Storage) Create(ws *v1.Workspace) error

func (*S3Storage) Delete

func (s *S3Storage) Delete(name string) error

func (*S3Storage) Get

func (s *S3Storage) Get(name string) (*v1.Workspace, error)

func (*S3Storage) GetCurrent

func (s *S3Storage) GetCurrent() (string, error)

func (*S3Storage) GetNames

func (s *S3Storage) GetNames() ([]string, error)

func (*S3Storage) SetCurrent

func (s *S3Storage) SetCurrent(name string) error

func (*S3Storage) Update

func (s *S3Storage) Update(ws *v1.Workspace) error

Jump to

Keyboard shortcuts

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