swift

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package swift implements common object storage abstractions against OpenStack swift APIs.

Index

Constants

View Source
const (
	// DirDelim is the delimiter used to model a directory structure in an object store bucket.
	DirDelim = '/'
	// Name of the directory in bucket, where to store file parts of SLO and DLO.
	SegmentsDir = "segments/"
)

Variables

View Source
var DefaultConfig = Config{
	AuthVersion:    0,
	ChunkSize:      1024 * 1024 * 1024,
	Retries:        3,
	ConnectTimeout: model.Duration(10 * time.Second),
	Timeout:        model.Duration(5 * time.Minute),
}

Functions

func NewTestContainer

func NewTestContainer(t testing.TB) (objstore.Bucket, func(), error)

NewTestContainer creates test objStore client that before returning creates temporary container. In a close function it empties and deletes the container.

Types

type Config added in v0.26.0

type Config struct {
	AuthVersion            int            `yaml:"auth_version"`
	AuthUrl                string         `yaml:"auth_url"`
	Username               string         `yaml:"username"`
	UserDomainName         string         `yaml:"user_domain_name"`
	UserDomainID           string         `yaml:"user_domain_id"`
	UserId                 string         `yaml:"user_id"`
	Password               string         `yaml:"password"`
	DomainId               string         `yaml:"domain_id"`
	DomainName             string         `yaml:"domain_name"`
	ProjectID              string         `yaml:"project_id"`
	ProjectName            string         `yaml:"project_name"`
	ProjectDomainID        string         `yaml:"project_domain_id"`
	ProjectDomainName      string         `yaml:"project_domain_name"`
	RegionName             string         `yaml:"region_name"`
	ContainerName          string         `yaml:"container_name"`
	ChunkSize              int64          `yaml:"large_object_chunk_size"`
	SegmentContainerName   string         `yaml:"large_object_segments_container_name"`
	Retries                int            `yaml:"retries"`
	ConnectTimeout         model.Duration `yaml:"connect_timeout"`
	Timeout                model.Duration `yaml:"timeout"`
	UseDynamicLargeObjects bool           `yaml:"use_dynamic_large_objects"`
}

type Container

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

func NewContainer

func NewContainer(logger log.Logger, conf []byte) (*Container, error)

func NewContainerFromConfig added in v0.26.0

func NewContainerFromConfig(logger log.Logger, sc *Config, createContainer bool) (*Container, error)

func (*Container) Attributes added in v0.26.0

func (c *Container) Attributes(_ context.Context, name string) (objstore.ObjectAttributes, error)

Attributes returns information about the specified object.

func (*Container) Close

func (*Container) Close() error

func (*Container) Delete

func (c *Container) Delete(_ context.Context, name string) error

Delete removes the object with the given name.

func (*Container) Exists

func (c *Container) Exists(_ context.Context, name string) (bool, error)

Exists checks if the given object exists.

func (*Container) Get

func (c *Container) Get(_ context.Context, name string) (io.ReadCloser, error)

Get returns a reader for the given object name.

func (*Container) GetRange

func (c *Container) GetRange(_ context.Context, name string, off, length int64) (io.ReadCloser, error)

func (*Container) IsObjNotFoundErr

func (c *Container) IsObjNotFoundErr(err error) bool

IsObjNotFoundErr returns true if error means that object is not found. Relevant to Get operations.

func (*Container) Iter

func (c *Container) Iter(_ context.Context, dir string, f func(string) error, options ...objstore.IterOption) error

Iter calls f for each entry in the given directory. The argument to f is the full object name including the prefix of the inspected directory.

func (*Container) Name

func (c *Container) Name() string

Name returns the container name for swift.

func (*Container) Upload

func (c *Container) Upload(_ context.Context, name string, r io.Reader) (err error)

Upload writes the contents of the reader as an object into the container.

Jump to

Keyboard shortcuts

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