Documentation

Overview

    Package cas manages content addressable storage.

    Index

    Constants

    View Source
    const (
    	// DefaultBatchByteLimit is bytes limit for cas BatchUploadBlobs.
    	DefaultBatchByteLimit = 4 * 1024 * 1024
    )

    Variables

    This section is empty.

    Functions

    func Download

    func Download(ctx context.Context, bs bpb.ByteStreamClient, wr io.Writer, resname string) (int64, error)

      Download downloads blob specified by resname into w.

      func DownloadDigest

      func DownloadDigest(ctx context.Context, bs bpb.ByteStreamClient, wr io.Writer, instance string, digest *rpb.Digest) error

        DownloadDigest downloads blob specified resname/digest into w.

        func ParseResName

        func ParseResName(name string) (*rpb.Digest, error)

          ParseResName parses resource name; digest string formatted as "blobs/<hash>/<sizebytes>". It ignores prior to "blobs", and after <sizebytes>. https://github.com/bazelbuild/remote-apis/blob/c1c1ad2c97ed18943adb55f06657440daa60d833/build/bazel/remote/execution/v2/remote_execution.proto#L168

          func Upload

          func Upload(ctx context.Context, bs bpb.ByteStreamClient, resname string, size int64, rd io.Reader) error

            Upload uploads blob specified by resname from rd.

            func UploadDigest

            func UploadDigest(ctx context.Context, bs bpb.ByteStreamClient, instance string, digest *rpb.Digest, rd io.Reader) error

            Types

            type CAS

            type CAS struct {
            	Client
            	*digest.Store
            
            	CacheCapabilities *rpb.CacheCapabilities
            }

              CAS is content-addressable-storage synced between local and cas service.

              func (CAS) Missing

              func (c CAS) Missing(ctx context.Context, instance string, blobs []*rpb.Digest) ([]*rpb.Digest, error)

                Missing checks blobs in local exists in instance of cas service, and returns missing blobs.

                func (CAS) Upload

                func (c CAS) Upload(ctx context.Context, instance string, sema chan struct{}, blobs ...*rpb.Digest) error

                  Upload uploads blobs stored in Store to instance of cas service.

                  type Client

                  type Client interface {
                  	CAS() rpb.ContentAddressableStorageClient
                  	ByteStream() bpb.ByteStreamClient
                  }

                    Client is a client of cas service.

                    func NewClient

                    func NewClient(conn *grpc.ClientConn) Client

                      NewClient creates client from conn.

                      type MissingBlob

                      type MissingBlob struct {
                      	Digest *rpb.Digest
                      	Err    error
                      }

                        MissingBlob is a missing blog.

                        type MissingError

                        type MissingError struct {
                        	Blobs []MissingBlob
                        }

                          MissingError is an error about missing content for blobs.

                          func (MissingError) Error

                          func (e MissingError) Error() string