swift

package
v3.0.0-...-1c69814 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Private    = ACL("")
	PublicRead = ACL(".r:*,.rlistings")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL string

type Client

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

Client provides a means to access the OpenStack Object Storage Service.

func New

func New(client client.Client) *Client

New creates a new Client.

func (*Client) CreateContainer

func (c *Client) CreateContainer(containerName string, acl ACL) error

CreateContainer creates a container with the given name.

func (*Client) DeleteContainer

func (c *Client) DeleteContainer(containerName string) error

DeleteContainer deletes the specified container.

func (*Client) DeleteObject

func (c *Client) DeleteObject(containerName, objectName string) error

DeleteObject removes an object from the storage system permanently.

func (*Client) GetObject

func (c *Client) GetObject(containerName, objectName string) (obj []byte, err error)

GetObject retrieves the specified object's data.

func (*Client) GetReader

func (c *Client) GetReader(containerName, objectName string) (_ io.ReadCloser, _ http.Header, err error)

GetReader returns a reader from which the object's data can be read, and the HTTP header of the initial response.

func (*Client) HeadObject

func (c *Client) HeadObject(containerName, objectName string) (http.Header, error)

HeadObject retrieves object metadata and other standard HTTP headers.

func (*Client) List

func (c *Client) List(containerName, prefix, delim, marker string, limit int) (contents []ContainerContents, err error)

List lists the objects in a bucket. TODO describe prefix, delim, marker, limit parameters.

func (*Client) OpenObject

func (c *Client) OpenObject(containerName, objectName string, readAhead int64) (Object, http.Header, error)

OpenObject opens an object for reading. The readAhead parameter governs how much data is scheduled to be read speculatively from the object before actual Read requests are issued. If readAhead is -1, an indefinite amount of data will be requested; if readAhead is 0, no data will be requested.

func (*Client) PutObject

func (c *Client) PutObject(containerName, objectName string, data []byte) error

PutObject writes, or overwrites, an object's content and metadata.

func (*Client) PutReader

func (c *Client) PutReader(containerName, objectName string, r io.Reader, length int64) error

PutReader writes, or overwrites, an object's content and metadata. The object's content will be read from r, and should have the given length. If r does not implement io.Seeker, the entire content will be read into memory before sending the request (so that the request can be retried if needed) otherwise Seek will be used to rewind the request on retry.

func (*Client) SignedURL

func (c *Client) SignedURL(containerName, file string, expires time.Time) (string, error)

SignedURL returns a signed URL that allows anyone holding the URL to retrieve the object at path. The signature is valid until expires.

func (*Client) URL

func (c *Client) URL(containerName, file string) (string, error)

URL returns a non-signed URL that allows retrieving the object at path. It only works if the object is publicly readable (see SignedURL).

type ContainerContents

type ContainerContents struct {
	Name         string `json:"name"`
	Hash         string `json:"hash"`
	LengthBytes  int    `json:"bytes"`
	ContentType  string `json:"content_type"`
	LastModified string `json:"last_modified"`
}

ContainerContents describes a single container and its contents.

type Object

type Object interface {
	// Size returns the size of the object.
	Size() int64

	io.ReadSeeker
	io.Closer
}

Object is the interface provided by an Swift object.

Jump to

Keyboard shortcuts

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