cloudstorage

package
v0.0.0-...-29f350e Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Kind = "google"

Kind represents the name of the location/storage type.

Variables

View Source
var (
	// ErrNotFound ...
	ErrNotFound = errors.New("google storage not found")
)

Functions

This section is empty.

Types

type VBucket

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

VBucket is Voda Bucket which is wrapper of google cloud storage "Bucket"

func (*VBucket) Bucket

func (vb *VBucket) Bucket() *storage.BucketHandle

Bucket returns the google bucket attributes

func (*VBucket) ID

func (vb *VBucket) ID() string

ID returns a string value which represents the name of the container. TODO: UUID

func (*VBucket) Name

func (vb *VBucket) Name() string

Name returns a string value which represents the name of the container.

func (*VBucket) Put

func (vb *VBucket) Put(name string, r io.Reader, size int64, metadata map[string]interface{}) (*VItem, error)

Put sends a request to upload content to the container. The arguments received are the name of the item, a reader representing the content, and the size of the file.

func (*VBucket) RemoveItem

func (vb *VBucket) RemoveItem(id string) error

RemoveItem will delete a google storage Object

func (*VBucket) VItem

func (vb *VBucket) VItem(id string) (*VItem, error)

VItem returns VodaItem (*VItem)

type VClient

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

VClient ...

func GetClient

func GetClient() *VClient

GetClient ...

func (*VClient) Close

func (vc *VClient) Close()

Close ...

func (*VClient) ItemByURL

func (vc *VClient) ItemByURL(url *url.URL) (*VItem, error)

ItemByURL get url and retuns real item itself (VItem)

func (*VClient) VBucket

func (vc *VClient) VBucket(id string) (*VBucket, error)

VBucket retrieves a google cloud bucket based on its name which must be exact.

type VItem

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

VItem is a Voda Item, which wraps Google Cloud Storage Bucket's file itself.

func (*VItem) DownloadURL

func (vi *VItem) DownloadURL() *url.URL

DownloadURL ...

func (*VItem) ETag

func (vi *VItem) ETag() (string, error)

ETag returns the ETag value

func (*VItem) ID

func (vi *VItem) ID() string

ID returns a string value that represents the name of a file.

func (*VItem) LastMod

func (vi *VItem) LastMod() (time.Time, error)

LastMod returns the last modified date of the item.

func (*VItem) Metadata

func (vi *VItem) Metadata() (map[string]interface{}, error)

Metadata returns a nil map and no error.

func (*VItem) Name

func (vi *VItem) Name() string

Name returns a string value that represents the name of the file.

func (*VItem) Open

func (vi *VItem) Open() (io.ReadCloser, error)

Open returns an io.ReadCloser to the object. Useful for downloading/streaming the object.

func (*VItem) OpenRange

func (vi *VItem) OpenRange(start, end uint64) (io.ReadCloser, error)

OpenRange returns an io.Reader to the object for a specific byte range

func (*VItem) Size

func (vi *VItem) Size() (int64, error)

Size returns the size of an item in bytes.

func (*VItem) StorageObject

func (vi *VItem) StorageObject() *storage.ObjectAttrs

StorageObject returns the Google Storage Object

func (*VItem) URL

func (vi *VItem) URL() *url.URL

URL returns a url which follows the predefined format

Jump to

Keyboard shortcuts

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