gcsproxy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReadProxy

func NewReadProxy(
	o *gcs.Object,
	rl lease.ReadLease,
	chunkSize uint64,
	leaser lease.FileLeaser,
	bucket gcs.Bucket) (rp lease.ReadProxy)

Create a view on the given GCS object generation. If rl is non-nil, it must contain a lease for the contents of the object and will be used when possible instead of re-reading the object.

If the object is larger than the given chunk size, we will only read and cache portions of it at a time.

Types

type ObjectSyncer added in v0.2.0

type ObjectSyncer interface {
	// Given an object record and content that was originally derived from that
	// object's contents (and potentially modified):
	//
	// *   If the content has not been modified, return a nil read lease and a
	//     nil new object.
	//
	// *   Otherwise, write out a new generation in the bucket (failing with
	//     *gcs.PreconditionError if the source generation is no longer current)
	//     and return a read lease for that object's contents.
	//
	// In the second case, the mutable.Content is destroyed. Otherwise, including
	// when this function fails, it is guaranteed to still be valid.
	SyncObject(
		ctx context.Context,
		srcObject *gcs.Object,
		content mutable.Content) (rl lease.ReadLease, o *gcs.Object, err error)
}

Safe for concurrent access.

func NewObjectSyncer added in v0.2.0

func NewObjectSyncer(
	appendThreshold int64,
	tmpObjectPrefix string,
	bucket gcs.Bucket) (os ObjectSyncer)

Create an object syncer that syncs into the supplied bucket.

When the source object has been changed only by appending, and the source object's size is at least appendThreshold, we will "append" to it by writing out a temporary blob and composing it with the source object.

Temporary blobs have names beginning with tmpObjectPrefix. We make an effort to delete them, but if we are interrupted for some reason we may not be able to do so. Therefore the user should arrange for garbage collection.

Jump to

Keyboard shortcuts

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