blobstore

package
v0.0.0-...-ea22f37 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBatchedStoreBlobAccess

func NewBatchedStoreBlobAccess(blobAccess blobstore.BlobAccess, blobKeyFormat digest.KeyFormat, batchSize int, putSemaphore *semaphore.Weighted) (blobstore.BlobAccess, func(ctx context.Context) error)

NewBatchedStoreBlobAccess is an adapter for BlobAccess that causes Put() operations to be enqueued. When a sufficient number of operations are enqueued, a FindMissing() call is generated to determine which blobs actually need to be stored. Writes for blobs with the same digest are merged.

This adapter may be used by the worker to speed up the uploading phase of actions.

func NewExistencePreconditionBlobAccess

func NewExistencePreconditionBlobAccess(blobAccess blobstore.BlobAccess) blobstore.BlobAccess

NewExistencePreconditionBlobAccess wraps a BlobAccess into a version that returns GRPC status code "FAILED_PRECONDITION" instead of "NOT_FOUND" for Get() operations. This is used by worker processes to make Execution::Execute() comply to the protocol.

func NewSuspendingBlobAccess

func NewSuspendingBlobAccess(base blobstore.BlobAccess, suspendable clock.Suspendable) blobstore.BlobAccess

NewSuspendingBlobAccess is a decorator for BlobAccess that simply forwards all methods. Before and after each call, it suspends and resumes a clock.Suspendable object, respectively.

This decorator is used in combination with SuspendableClock, allowing FUSE-based workers to compensate the execution timeout of build actions for any time spent downloading the input root.

Types

type MutableProtoHandle

type MutableProtoHandle[T proto.Message] interface {
	GetMutableProto() T
	Release(isDirty bool)
}

MutableProtoHandle is a handle that is returned by MutableProtoStore. It contains a MutableProto message that contains timing information of previous executions of similar actions.

type MutableProtoStore

type MutableProtoStore[T proto.Message] interface {
	Get(ctx context.Context, reducedActionDigest digest.Digest) (MutableProtoHandle[T], error)
}

MutableProtoStore is a store for Protobuf messages, allowing them both to be read and written. Because multiple operations may interact with a single Protobuf message, this interface permits concurrent access to the same message.

The Get() function may be called in parallel, yielding a MutableProtoHandle. Because these handles are shared, all methods on all handles obtained from a single store must be called while holding a global lock. The Protobuf message embedded in the handle gets invalidated after locks are dropped.

func NewBlobAccessMutableProtoStore

func NewBlobAccessMutableProtoStore[T any, TProto interface {
	*T
	proto.Message
}](initialSizeClassCache blobstore.BlobAccess, maximumMessageSizeBytes int) MutableProtoStore[TProto]

NewBlobAccessMutableProtoStore creates an instance of MutableProtoStore that is backed by BlobAccess.

What makes this interface harder to implement is that releasing MutableProtoHandle is performed while holding locks. We can't block, nor can we propagate errors or perform retries. To solve this, this implementation keeps track of a list of all handles that need to be written. Every time a handle is created, we write a couple of released handles back to storage. This ensures that the number of handles remains proportional to actual use.

Jump to

Keyboard shortcuts

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