objectstore

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause Imports: 23 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSS3Store

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

AWSS3Store implements ObjectStore interface with filesystem driver

func (*AWSS3Store) Delete

func (s *AWSS3Store) Delete(ctx context.Context, o Object) error

Delete deletes an artifact from a bucket

func (*AWSS3Store) DeleteContainer

func (s *AWSS3Store) DeleteContainer(ctx context.Context, path string) error

DeleteContainer deletes an artifact container (= directory) from a bucket

func (*AWSS3Store) Fetch

func (s *AWSS3Store) Fetch(ctx context.Context, o Object) (io.ReadCloser, error)

func (*AWSS3Store) FetchURL

func (s *AWSS3Store) FetchURL(o Object) (string, string, error)

FetchURL returns a temporary url and a secret key to fetch an object

func (*AWSS3Store) GetProjectIntegration

func (s *AWSS3Store) GetProjectIntegration() sdk.ProjectIntegration

func (*AWSS3Store) Status

func (*AWSS3Store) Store

func (s *AWSS3Store) Store(o Object, data io.ReadCloser) (string, error)

func (*AWSS3Store) StoreURL

func (s *AWSS3Store) StoreURL(o Object, contentType string) (string, string, error)

StoreURL returns a temporary url and a secret key to store an object

func (*AWSS3Store) TemporaryURLSupported

func (s *AWSS3Store) TemporaryURLSupported() bool

type Config

type Config struct {
	IntegrationName string
	ProjectName     string
	Kind            Kind
	Options         ConfigOptions
}

Config represents all the configuration for all objectstore drivers

type ConfigOptions

type ConfigOptions struct {
	AWSS3      ConfigOptionsAWSS3
	Openstack  ConfigOptionsOpenstack
	Filesystem ConfigOptionsFilesystem
}

ConfigOptions is used by Config

type ConfigOptionsAWSS3

type ConfigOptionsAWSS3 struct {
	Region     string
	BucketName string
	Prefix     string
	// Auth options, can provide a profile name, from environment or directly provide access keys
	AuthFromEnvironment bool
	SharedCredsFile     string
	Profile             string
	AccessKeyID         string
	SecretAccessKey     string
	SessionToken        string
	Endpoint            string //optional
	DisableSSL          bool   //optional
	ForcePathStyle      bool   //optional
}

ConfigOptionsAWSS3 is used by ConfigOptions

type ConfigOptionsFilesystem

type ConfigOptionsFilesystem struct {
	Basedir string
}

ConfigOptionsFilesystem is used by ConfigOptions

type ConfigOptionsOpenstack

type ConfigOptionsOpenstack struct {
	Address         string
	Username        string
	Password        string
	Tenant          string
	Domain          string
	Region          string
	ContainerPrefix string
	DisableTempURL  bool
}

ConfigOptionsOpenstack is used by ConfigOptions

type Driver

type Driver interface {
	GetProjectIntegration() sdk.ProjectIntegration
	Status(ctx context.Context) sdk.MonitoringStatusLine
	Store(o Object, data io.ReadCloser) (string, error)
	Fetch(ctx context.Context, o Object) (io.ReadCloser, error)
	Delete(ctx context.Context, o Object) error
	DeleteContainer(ctx context.Context, containerPath string) error
	TemporaryURLSupported() bool
}

Driver allows artifact to be stored and retrieve the same way to any backend - Openstack / Swift - Filesystem

func GetDriver

func GetDriver(ctx context.Context, db gorp.SqlExecutor, sharedStorage Driver, projectKey, integrationName string) (Driver, error)

GetDriver returns the storage driver, integration driver or sharedInfra shared otherwise

func Init

func Init(c context.Context, cfg Config) (Driver, error)

Init initialise a new ArtifactStorage

type DriverWithRedirect

type DriverWithRedirect interface {
	// StoreURL returns a temporary url and a secret key to store an object
	StoreURL(o Object, contentType string) (url string, key string, err error)
	// FetchURL returns a temporary url and a secret key to fetch an object
	FetchURL(o Object) (url string, key string, err error)
}

DriverWithRedirect has to be implemented if your storage backend supports temp url

type FilesystemStore

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

FilesystemStore implements ObjectStore interface with filesystem driver

func (*FilesystemStore) Delete

func (fss *FilesystemStore) Delete(ctx context.Context, o Object) error

Delete deletes data from disk

func (*FilesystemStore) DeleteContainer

func (fss *FilesystemStore) DeleteContainer(ctx context.Context, containerPath string) error

DeleteContainer deletes a directory from disk

func (*FilesystemStore) Fetch

func (fss *FilesystemStore) Fetch(ctx context.Context, o Object) (io.ReadCloser, error)

Fetch lookup on disk for data

func (*FilesystemStore) GetProjectIntegration

func (fss *FilesystemStore) GetProjectIntegration() sdk.ProjectIntegration

GetProjectIntegration returns current projet Integration, nil otherwise

func (*FilesystemStore) Status

Status return filesystem storage status

func (*FilesystemStore) Store

func (fss *FilesystemStore) Store(o Object, data io.ReadCloser) (string, error)

Store store a object on disk

func (*FilesystemStore) TemporaryURLSupported

func (fss *FilesystemStore) TemporaryURLSupported() bool

TemporaryURLSupported returns true is temporary URL are supported

type Kind

type Kind int

Kind will define const defining all supported objecstore drivers

const (
	Openstack Kind = iota
	Filesystem
	Swift
	AWSS3
)

These are the defined objecstore drivers

type Object

type Object interface {
	GetName() string
	GetPath() string
}

Object is the interface for stuff needed to be stored in object store

type SSHStore

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

SSHStore implements ObjectStore interface with ssh

func (*SSHStore) Delete

func (s *SSHStore) Delete(ctx context.Context, o Object) error

Delete data on disk

func (*SSHStore) DeleteContainer

func (s *SSHStore) DeleteContainer(ctx context.Context, containerPath string) error

DeleteContainer deletes a directory from disk

func (*SSHStore) Fetch

func (s *SSHStore) Fetch(ctx context.Context, o Object) (io.ReadCloser, error)

Fetch lookup on disk for data

func (*SSHStore) Status

Status return filesystem storage status

func (*SSHStore) Store

func (s *SSHStore) Store(o Object, data io.ReadCloser) (string, error)

Store store a object on disk

func (*SSHStore) TemporaryURLSupported

func (s *SSHStore) TemporaryURLSupported() bool

TemporaryURLSupported returns true is temporary URL are supported

type SwiftStore

type SwiftStore struct {
	swift.Connection
	// contains filtered or unexported fields
}

SwiftStore implements ObjectStore interface with openstack swift implementation

func (*SwiftStore) Delete

func (s *SwiftStore) Delete(ctx context.Context, o Object) error

Delete deletes an object from swift

func (*SwiftStore) DeleteContainer

func (s *SwiftStore) DeleteContainer(ctx context.Context, containerPath string) error

DeleteContainer deletes a container from swift

func (*SwiftStore) Fetch

func (s *SwiftStore) Fetch(ctx context.Context, o Object) (io.ReadCloser, error)

Fetch an object from swift

func (*SwiftStore) FetchURL

func (s *SwiftStore) FetchURL(o Object) (string, string, error)

FetchURL returns a temporary url and a secret key to fetch an object

func (*SwiftStore) GetProjectIntegration

func (s *SwiftStore) GetProjectIntegration() sdk.ProjectIntegration

GetProjectIntegration returns current projet Integration, nil otherwise

func (*SwiftStore) Status

Status returns the status of swift account

func (*SwiftStore) Store

func (s *SwiftStore) Store(o Object, data io.ReadCloser) (string, error)

Store stores in swift

func (*SwiftStore) StoreURL

func (s *SwiftStore) StoreURL(o Object, contentType string) (string, string, error)

StoreURL returns a temporary url and a secret key to store an object

func (*SwiftStore) TemporaryURLSupported

func (s *SwiftStore) TemporaryURLSupported() bool

TemporaryURLSupported returns true is temporary URL are supported

Jump to

Keyboard shortcuts

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