Version: v0.0.26 Latest Latest

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

Go to latest
Published: Sep 30, 2022 License: BSD-3-Clause Imports: 24 Imported by: 0



Package cas manages content addressable storage.



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


This section is empty.


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>.

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


type CAS

type CAS struct {

	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

Jump to

Keyboard shortcuts

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