Documentation ¶
Index ¶
- func NewBucket(name string) (*bucket, error)
- type Bucket
- type MockBucket
- func (bucket *MockBucket) Close() error
- func (bucket *MockBucket) Delete(objectPath string) error
- func (bucket *MockBucket) DeleteStaleLock(objectPath string, staleAge time.Duration) error
- func (bucket *MockBucket) Download(objectPath string, localPath string) error
- func (bucket *MockBucket) Exists(objectPath string) (bool, error)
- func (bucket *MockBucket) Name() string
- func (bucket *MockBucket) ReleaseLock(objectPath string, generation int64) error
- func (bucket *MockBucket) Upload(localPath string, objectPath string, cacheControl string) error
- func (bucket *MockBucket) WaitForLock(objectPath string, maxWait time.Duration) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 // WaitForLock waits for a lock, timing out after maxTime. It returns a lock id / object generation number // that must be passed in to ReleaseLock WaitForLock(objectPath string, maxWait time.Duration) (int64, error) // DeleteStaleLock deletes a stale lock file if it exists and is older than staleAge DeleteStaleLock(objectPath string, staleAge time.Duration) error // ReleaseLock removes a lockfile ReleaseLock(objectPath string, generation int64) error // Exists returns true if the object exists, false otherwise Exists(objectPath string) (bool, error) // Upload uploads a local file to the bucket Upload(localPath string, objectPath string, cacheControl string) error // Download downloads an object in the bucket to a local file Download(objectPath string, localPath string) error }
Bucket offers higher-level operations on GCS buckets
type MockBucket ¶
func NewMockBucket ¶
func NewMockBucket(name string) *MockBucket
NewMockBucket creates a new MockBucket
func (*MockBucket) Close ¶
func (bucket *MockBucket) Close() error
Close closes gcs client associated with this bucket
func (*MockBucket) Delete ¶
func (bucket *MockBucket) Delete(objectPath string) error
Delete deletes an object in the bucket
func (*MockBucket) DeleteStaleLock ¶
func (bucket *MockBucket) DeleteStaleLock(objectPath string, staleAge time.Duration) error
DeleteStaleLock deletes a stale lock file if it exists and is older than staleAge
func (*MockBucket) Download ¶
func (bucket *MockBucket) Download(objectPath string, localPath string) error
Download downloads an object in the bucket to a local file
func (*MockBucket) Exists ¶
func (bucket *MockBucket) Exists(objectPath string) (bool, error)
Exists returns true if the object exists, false otherwise
func (*MockBucket) Name ¶
func (bucket *MockBucket) Name() string
Name returns the name of this bucket
func (*MockBucket) ReleaseLock ¶
func (bucket *MockBucket) ReleaseLock(objectPath string, generation int64) error
ReleaseLock removes a lockfile
func (*MockBucket) Upload ¶
func (bucket *MockBucket) Upload(localPath string, objectPath string, cacheControl string) error
Upload uploads a local file to the bucket
func (*MockBucket) WaitForLock ¶
WaitForLock waits for a lock, timing out after maxTime. It returns a lock id / object generation number that must be passed in to ReleaseLock
Click to show internal directories.
Click to hide internal directories.