camlistore.org: camlistore.org/pkg/misc/azure/storage Index | Files

package storage

import "camlistore.org/pkg/misc/azure/storage"

Package storage implements a generic Azure storage client, not specific to Camlistore.

Index

Package Files

auth.go client.go

func IsValidContainer Uses

func IsValidContainer(container string) bool

IsValidContainer reports whether container is a valid container name, per Microsoft's naming restrictions.

See http://msdn.microsoft.com/en-us/library/azure/dd135715.aspx

type Auth Uses

type Auth struct {
    Account   string
    AccessKey []byte
}

Auth contains the credentials needed to connect to Azure storage

func (*Auth) SignRequest Uses

func (a *Auth) SignRequest(req *http.Request)

SignRequest takes an existing *http.Request and signs it with the credentials in Auth. If no date header is set, SignRequest will set the date header to the current UTC time.

type Blob Uses

type Blob struct {
    Name       string
    Properties BlobProperties
}

Blob holds the name and properties of a blob when returned with a list-operation

type BlobProperties Uses

type BlobProperties struct {
    ContentLength int `xml:"Content-Length"`
}

BlobProperties holds some information about the blobs. There are many more fields than just the one below, see: http://msdn.microsoft.com/en-us/library/azure/dd135734.aspx

type Client Uses

type Client struct {
    *Auth
    Transport http.RoundTripper // or nil for the default

    // Hostname is the hostname to use in the requests.
    // By default its <account>.blob.core.windows.net.
    Hostname string
}

Client is an Azure storage client.

func (*Client) Containers Uses

func (c *Client) Containers() ([]*Container, error)

Containers list the containers active under the current account.

func (*Client) Delete Uses

func (c *Client) Delete(container, key string) error

Delete deletes a blob from the specified container. It may take a few moments before the blob is actually deleted by Azure.

func (*Client) Get Uses

func (c *Client) Get(container, key string) (body io.ReadCloser, size int64, err error)

Get retrieves a blob from Azure or returns os.ErrNotExist if not found

func (*Client) GetPartial Uses

func (c *Client) GetPartial(container, key string, offset, length int64) (rc io.ReadCloser, err error)

GetPartial fetches part of the blob in container. If length is negative, the rest of the object is returned. The caller must close rc.

func (*Client) ListBlobs Uses

func (c *Client) ListBlobs(container string, maxResults int) (blobs []*Blob, err error)

ListBlobs returns 0 to maxKeys (inclusive) items from the provided container. If the length of the returned items is equal to maxKeys, there is no indication whether or not the returned list is truncated.

func (*Client) PutObject Uses

func (c *Client) PutObject(key, container string, md5 hash.Hash, size int64, body io.Reader) error

PutObject puts a blob to the specified container on Azure

func (*Client) Stat Uses

func (c *Client) Stat(key, container string) (size int64, reterr error)

Stat Stats a blob in Azure. It returns 0, os.ErrNotExist if not found on Azure, otherwise reterr is real.

type Container Uses

type Container struct {
    Name string
}

Container is the result of an enumeration of containers TODO(gv): There are come more properties being exposed by Azure that we don't need right now

type Error Uses

type Error struct {
    Op     string
    Code   int         // HTTP status code
    Body   []byte      // response body
    Header http.Header // response headers

    AzureError XMLError
}

Error is the type returned by some API operations.

func (*Error) Error Uses

func (e *Error) Error() string

Error returns a formatted error message

type XMLError Uses

type XMLError struct {
    Code                      string
    Message                   string
    AuthenticationErrorDetail string
}

XMLError is the Error response from Azure.

Package storage imports 18 packages (graph) and is imported by 1 packages. Updated 2018-03-14. Refresh now. Tools for package owners.