Index | Files

package googlestorage

import ""

Package googlestorage is simple Google Cloud Storage client.

It does not include any Camlistore-specific logic.


Package Files



const (

    // Scope is the OAuth2 scope used for Google Cloud Storage.
    Scope = ""

type Client Uses

type Client struct {
    // contains filtered or unexported fields

A Client provides access to Google Cloud Storage.

func NewClient Uses

func NewClient(oauthClient *http.Client) *Client

func NewServiceClient Uses

func NewServiceClient() (*Client, error)

NewServiceClient returns a Client for use when running on Google Compute Engine. This client can access buckets owned by the same project ID as the VM.

func (*Client) BucketInfo Uses

func (c *Client) BucketInfo(bucket string) (*api.Bucket, error)

BucketInfo returns information about a bucket.

func (*Client) DeleteObject Uses

func (c *Client) DeleteObject(obj *Object) error

DeleteObject removes an object.

func (*Client) EnumerateObjects Uses

func (c *Client) EnumerateObjects(bucket, after string, limit int) ([]SizedObject, error)

EnumerateObjects lists the objects in a bucket. If after is non-empty, listing will begin with lexically greater object names. If limit is non-zero, the length of the list will be limited to that number.

func (*Client) GetObject Uses

func (c *Client) GetObject(obj *Object) (rc io.ReadCloser, size int64, err error)

GetObject fetches a Google Cloud Storage object. The caller must close rc.

func (*Client) GetPartialObject Uses

func (c *Client) GetPartialObject(obj Object, offset, length int64) (rc io.ReadCloser, err error)

GetPartialObject fetches part of a Google Cloud Storage object. If length is negative, the rest of the object is returned. The caller must close rc.

func (*Client) PutObject Uses

func (c *Client) PutObject(obj *Object, content io.Reader) error

PutObject uploads a Google Cloud Storage object. shouldRetry will be true if the put failed due to authorization, but credentials have been refreshed and another attempt is likely to succeed. In this case, content will have been consumed.

func (*Client) StatObject Uses

func (c *Client) StatObject(obj *Object) (size int64, exists bool, err error)

StatObject checks for the size & existence of a Google Cloud Storage object. Non-existence of a file is not an error.

type Object Uses

type Object struct {
    Bucket string
    Key    string

An Object holds the name of an object (its bucket and key) within Google Cloud Storage.

func (*Object) String Uses

func (o *Object) String() string

type SizedObject Uses

type SizedObject struct {
    Size int64

A SizedObject holds the bucket, key, and size of an object.

func (SizedObject) String Uses

func (so SizedObject) String() string

Package googlestorage imports 18 packages (graph) and is imported by 36 packages. Updated 2018-01-11. Refresh now. Tools for package owners.