Documentation ¶
Overview ¶
Package storage implements a generic Azure storage client, not specific to Perkeep.
Index ¶
- func IsValidContainer(container string) bool
- type Auth
- type Blob
- type BlobProperties
- type Client
- func (c *Client) Containers(ctx context.Context) ([]*Container, error)
- func (c *Client) Delete(ctx context.Context, container, key string) error
- func (c *Client) Get(ctx context.Context, container, key string) (body io.ReadCloser, size int64, err error)
- func (c *Client) GetPartial(ctx context.Context, container, key string, offset, length int64) (rc io.ReadCloser, err error)
- func (c *Client) ListBlobs(ctx context.Context, container string, maxResults int) (blobs []*Blob, err error)
- func (c *Client) PutObject(ctx context.Context, key, container string, md5 hash.Hash, size int64, ...) error
- func (c *Client) Stat(ctx context.Context, key, container string) (size int64, reterr error)
- type Container
- type Error
- type XMLError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidContainer ¶
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
Types ¶
type Auth ¶
Auth contains the credentials needed to connect to Azure storage
func (*Auth) SignRequest ¶
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 ¶
type Blob struct { Name string Properties BlobProperties }
Blob holds the name and properties of a blob when returned with a list-operation
type BlobProperties ¶
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 ¶
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 ¶
Containers list the containers active under the current account.
func (*Client) Delete ¶
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 ¶
func (c *Client) Get(ctx context.Context, 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 ¶
func (c *Client) GetPartial(ctx context.Context, 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 ¶
func (c *Client) ListBlobs(ctx context.Context, 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.
type Container ¶
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