storages

package
v0.13.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGraphNotExist     = errors.New("graph does not exist")
	ErrGraphAlreadyExist = errors.New("graph has already existed")
)

Functions

func GenGenericOssResourcePrefixKey

func GenGenericOssResourcePrefixKey(prefix, project, workspace string) string

GenGenericOssResourcePrefixKey generates generic oss resource prefix, which is use for OssStorage and S3Storage.

func GenGraphDirPath

func GenGraphDirPath(dir, project, workspace string) string

GenResourceDirPath generates the resource dir path, which is used for LocalStorage.

func GenResourcePrefixKeyWithPath

func GenResourcePrefixKeyWithPath(prefix, path string) string

GenResourcePrefixKeyWithPath generates oss state file key with cloud and env instead of workspace, which is use for OssStorage and S3Storage.

Types

type LocalStorage

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

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

func NewLocalStorage

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

NewLocalStorage news local resource storage, and derives graph. For instance, local path is ~/.kusion/resources/project/workspace

func (*LocalStorage) CheckGraphStorageExistence

func (s *LocalStorage) CheckGraphStorageExistence() bool

CheckGraphStorageExistence checks whether the graph storage exists.

func (*LocalStorage) Create

func (s *LocalStorage) Create(r *v1.Graph) error

Create creates the graph in s3.

func (*LocalStorage) Delete

func (s *LocalStorage) Delete() error

Delete deletes the graph in s3

func (*LocalStorage) Get

func (s *LocalStorage) Get() (*v1.Graph, error)

Get gets the graph from local.

func (*LocalStorage) Update

func (s *LocalStorage) Update(r *v1.Graph) error

Update updates the graph in s3.

type OssStorage

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

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

func NewOssStorage

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

NewOssStorage news oss graph storage, and derives metadata.

func (*OssStorage) CheckGraphStorageExistence

func (s *OssStorage) CheckGraphStorageExistence() bool

CheckGraphStorageExistence checks whether the graph storage exists.

func (*OssStorage) Create

func (s *OssStorage) Create(r *v1.Graph) error

Create creates the graph in oss.

func (*OssStorage) Delete

func (s *OssStorage) Delete() error

Delete deletes the graph in oss.

func (*OssStorage) Get

func (s *OssStorage) Get() (*v1.Graph, error)

Get gets the graph from oss.

func (*OssStorage) Update

func (s *OssStorage) Update(r *v1.Graph) error

Update updates the graph in oss.

type S3Storage

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

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

func NewS3Storage

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

NewS3Storage news s3 graph storage, and derives metadata.

func (*S3Storage) CheckGraphStorageExistence

func (s *S3Storage) CheckGraphStorageExistence() bool

CheckGraphStorageExistence checks whether the graph storage exists.

func (*S3Storage) Create

func (s *S3Storage) Create(r *v1.Graph) error

Create creates the graph in s3.

func (*S3Storage) Delete

func (s *S3Storage) Delete() error

Delete deletes the graph in s3

func (*S3Storage) Get

func (s *S3Storage) Get() (*v1.Graph, error)

Get gets the graph from s3.

func (*S3Storage) Update

func (s *S3Storage) Update(r *v1.Graph) error

Update updates the graph in s3.

Jump to

Keyboard shortcuts

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