objectstorage

package
v21.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 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) (name string, ferr fail.Error)

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

func NewLocation

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

NewLocation creates an Object Storage location based on config

Types

type Bucket

type Bucket interface {

	// ListObjects list object names in a GetBucket
	ListObjects(string, string) ([]string, fail.Error)
	// Browse browses inside the GetBucket and execute a callback on each Object found
	Browse(string, string, func(Object) fail.Error) fail.Error
	// Clear deletes all the objects in path inside a bucket
	Clear(path, prefix string) fail.Error
	// CreateObject creates a new object in the bucket
	CreateObject(string) (Object, fail.Error)
	// InspectObject returns Object instance of an object in the GetBucket
	InspectObject(string) (Object, fail.Error)
	// DeleteObject delete an object from a stowContainer
	DeleteObject(string) fail.Error
	// ReadObject reads the content of an object
	ReadObject(string, io.Writer, int64, int64) (Object, fail.Error)
	// WriteObject writes into an object
	WriteObject(string, io.Reader, int64, abstract.ObjectStorageItemMetadata) (Object, fail.Error)
	// WriteMultiPartObject writes a lot of data into an object, cut in pieces
	WriteMultiPartObject(string, io.Reader, int64, int, 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(string, string) (int64, fail.Error)
	// GetSize returns the total size of all objects in the bucket
	GetSize(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
}

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(string) ([]string, fail.Error)
	// FindBucket returns true of bucket exists in stowLocation
	FindBucket(string) (bool, fail.Error)
	// InspectBucket returns info of the GetBucket
	InspectBucket(string) (abstract.ObjectStorageBucket, fail.Error)
	// CreateBucket creates a bucket
	CreateBucket(string) (abstract.ObjectStorageBucket, fail.Error)
	// DeleteBucket removes a bucket (need to be cleared before)
	DeleteBucket(string) fail.Error
	// ClearBucket empties a GetBucket
	ClearBucket(string, string, string) fail.Error

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

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

	// InspectObject ...
	InspectObject(string, string) (abstract.ObjectStorageItem, fail.Error)
	// HasObject ...
	HasObject(string, string) (bool, fail.Error)
	// ReadObject ...
	ReadObject(string, string, io.Writer, int64, int64) fail.Error
	// WriteMultiPartObject ...
	WriteMultiPartObject(string, string, io.Reader, int64, int, abstract.ObjectStorageItemMetadata) (abstract.ObjectStorageItem, fail.Error)
	// WriteObject ...
	WriteObject(string, string, io.Reader, int64, abstract.ObjectStorageItemMetadata) (abstract.ObjectStorageItem, fail.Error)
	// DeleteObject delete an object from a stowContainer
	DeleteObject(string, string) fail.Error

	// // ItemSize ?
	// ItemSize(ContainerName string, item string) (int64, fail.Error)
	// ItemEtag returns the Etag of an item
	ItemEtag(string, string) (string, fail.Error)
}

Location ...

type Object

type Object interface {
	Stored() (bool, fail.Error)

	Read(io.Writer, int64, int64) fail.Error
	Write(io.Reader, int64) fail.Error
	WriteMultiPart(io.Reader, int64, int) fail.Error
	Reload() fail.Error
	Delete() fail.Error
	AddMetadata(abstract.ObjectStorageItemMetadata) fail.Error
	ForceAddMetadata(abstract.ObjectStorageItemMetadata) fail.Error
	ReplaceMetadata(abstract.ObjectStorageItemMetadata) fail.Error

	GetID() (string, fail.Error)
	GetName() (string, fail.Error)
	GetLastUpdate() (time.Time, fail.Error)
	GetSize() (int64, fail.Error)
	GetETag() (string, fail.Error)
	GetMetadata() (abstract.ObjectStorageItemMetadata, fail.Error)
}

Object interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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