objectstorage

package
v22.11.7 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RootPath defines the path corresponding of the root of a Bucket
	RootPath = ""
	// NoPrefix corresponds to ... no prefix...
	NoPrefix = ""
	// NotFound is the 'Not found' error according to stow internals
	NotFound = "not found"
)
View Source
const (
	// BucketNamePrefix is the beginning of the name of the bucket for Metadata
	BucketNamePrefix = "0.safescale"
)

Variables

This section is empty.

Functions

func BuildMetadataBucketName

func BuildMetadataBucketName(driver, region, domain, project string, suffixFromCfg string) (name string, ferr fail.Error)

BuildMetadataBucketName builds the name of the bucket/stowContainer that will store metadata

Types

type Bucket

type Bucket interface {
	// ListObjects list object names in a GetBucket
	ListObjects(context.Context, string, string) ([]string, fail.Error)
	// Browse browses inside the GetBucket and execute a callback on each Object found
	Browse(context.Context, string, string, func(Object) fail.Error) fail.Error
	// Clear deletes all the objects in path inside a bucket
	Clear(ctx context.Context, path, prefix string) fail.Error
	// CreateObject creates a new object in the bucket
	CreateObject(context.Context, string) (Object, fail.Error)
	// InspectObject returns Object instance of an object in the GetBucket
	InspectObject(context.Context, string) (Object, fail.Error)
	// DeleteObject delete an object from a stowContainer
	DeleteObject(context.Context, string) fail.Error
	// ReadObject reads the content of an object
	ReadObject(context.Context, string, io.Writer, int64, int64) (Object, fail.Error)
	// WriteObject writes into an object
	WriteObject(context.Context, string, io.Reader, int64, abstract.ObjectStorageItemMetadata) (Object, fail.Error)

	// GetName returns the name of the bucket
	GetName() (string, fail.Error)
	// GetCount returns the number of objects in the GetBucket
	GetCount(context.Context, string, string) (int64, fail.Error)
	// GetSize returns the total size of all objects in the bucket
	GetSize(context.Context, string, string) (int64, string, fail.Error)
}

Bucket interface

type Config

type Config struct {
	Type             string
	EnvAuth          bool
	AuthVersion      int
	AuthURL          string
	EndpointType     string
	Endpoint         string
	TenantDomain     string
	Tenant           string
	Domain           string
	User             string
	Key              string
	SecretKey        string
	Region           string
	AvailabilityZone string
	ProjectID        string
	Credentials      string
	BucketName       string
	DNS              string
	Direct           bool // if true, no stow cache is used
	Suffix           string
}

Config represents a tenant configuration

type Location

type Location interface {
	// Protocol returns the name of the Object Storage protocol corresponding used by the location
	Protocol() (string, fail.Error)
	Configuration() (Config, fail.Error) // returns the configuration used to create Location
	// ListBuckets returns all bucket prefixed by a string given as a parameter
	ListBuckets(context.Context, string) ([]string, fail.Error)
	// FindBucket returns true of bucket exists in stowLocation
	FindBucket(context.Context, string) (bool, fail.Error)
	// InspectBucket returns info of the GetBucket
	InspectBucket(context.Context, string) (abstract.ObjectStorageBucket, fail.Error)
	// CreateBucket creates a bucket
	CreateBucket(context.Context, string) (abstract.ObjectStorageBucket, fail.Error)
	// DeleteBucket removes a bucket (need to be cleared before)
	DeleteBucket(context.Context, string) fail.Error
	// DownloadBucket downloads a bucket
	DownloadBucket(ctx context.Context, bucketName, decryptionKey string) ([]byte, fail.Error)

	// UploadBucket uploads a bucket
	UploadBucket(ctx context.Context, bucketName, localDirectory string) (ferr fail.Error)

	// ClearBucket empties a Bucket
	ClearBucket(context.Context, string, string, string) fail.Error

	// ListObjects lists the objects in a Bucket
	ListObjects(context.Context, string, string, string) ([]string, fail.Error)

	// InvalidateObject ...
	InvalidateObject(context.Context, string, string) fail.Error

	// InspectObject ...
	InspectObject(context.Context, string, string) (abstract.ObjectStorageItem, fail.Error)
	// HasObject ...
	HasObject(context.Context, string, string) (bool, fail.Error)
	// ReadObject ...
	ReadObject(context.Context, string, string, io.Writer, int64, int64) (bytes.Buffer, fail.Error)
	// WriteObject ...
	WriteObject(
		context.Context, string, string, io.Reader, int64, abstract.ObjectStorageItemMetadata,
	) (abstract.ObjectStorageItem, fail.Error)
	// DeleteObject delete an object from a stowContainer
	DeleteObject(context.Context, string, string) fail.Error
	// ItemEtag returns the Etag of an item
	ItemEtag(context.Context, string, string) (string, fail.Error)
}

Location ...

func NewLocation

func NewLocation(conf Config) (_ Location, ferr fail.Error)

NewLocation creates an Object Storage location based on config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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