Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket interface { // Name returns the name of the bucket Name() string // Close closes gcs client associated with this bucket Close() error // Exists returns true if the object exists, false otherwise Exists(objectName string) (bool, error) // Upload uploads a local file to the bucket Upload(localPath string, objectName string, attrs ...object.AttrSetter) error // Download downloads an object in the bucket to a local file Download(objectName string, localPath string) error // Read reads object contents Read(objectName string) ([]byte, error) // Write replaces object contents with given content Write(objectName string, content []byte, attrs ...object.AttrSetter) error // Delete deletes the object from the bucket Delete(objectName string) error // Attrs returns the attributes of an object (eg. creation time, cache control) Attrs(objectName string) (*storage.ObjectAttrs, error) // Update updates the attributes of an object (eg. cache control) Update(objectName string, attrs ...object.AttrSetter) error // NewLocker returns a Locker instance for the given object NewLocker(objectName string, maxWait time.Duration, options ...LockerOption) Locker }
Bucket offers a simple interface for operations on GCS buckets
type BucketOption ¶
type BucketOption func(options *BucketOptions)
type BucketOptions ¶
type BucketOptions struct { // Prefix is an optionally prefix to add to all object names in the bucket. Eg. // For bucket called "my-bucket" with a prefix of "my-prefix-", // bucket.Read("foo") will read the object "gs://my-bucket/my-prefix-foo" Prefix string }
BucketOptions optional configuration for a Bucket
type Locker ¶
type Locker interface { // ObjectName returns the name of the object associated with this lock ObjectName() string // Lock waits to acquire the lock, timing out after maxTime. It returns a lock id / object generation number // that must be passed in to Unlock Lock() (int64, error) // Unlock releases the lock. Unlock(lockId int64) error }
Locker is distributed locking mechanism implemented over GCS. Every Locker is associated with an object in a GCS bucket.
type LockerOption ¶
LockerOption used for configuring Locker options
Click to show internal directories.
Click to hide internal directories.