Package digest handles content digest for remote executon API,



This section is empty.


View Source
var (
	DefaultViews = []*view.View{
			Name:        "",
			Description: `number of digest cache entries`,
			Measure:     cacheStats,
			Aggregation: view.Sum(),
			Name:        "",
			Description: `digest cache operations`,
			Measure:     cacheStats,
			TagKeys: []tag.Key{
			Aggregation: view.Count(),


This section is empty.


type Cache

type Cache struct {
	// contains filtered or unexported fields

Cache caches file's digest data.

func NewCache

func NewCache(c cachepb.CacheServiceClient, maxEntries int) *Cache

NewCache creates new cache for digest data.

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, key string, src Source) (Data, error)

Get gets source's digest.

type Data

type Data interface {
	Digest() *rpb.Digest

Data is data identified by digest.

func Bytes

func Bytes(name string, b []byte) Data

Bytes creates data for bytes.

func FromSource

func FromSource(ctx context.Context, src Source) (Data, error)

FromSource creates digests from source.

func New

func New(src Source, d *rpb.Digest) Data

New creates digest data from source, which digest is d.

func Proto

func Proto(m proto.Message) (Data, error)

Proto creates data for proto message.

type Source

type Source interface {
	Open(context.Context) (io.ReadCloser, error)
	String() string

Source accesses data source for the digest.

type Store

type Store struct {
	// contains filtered or unexported fields

Store works as local content addressable storage.

func NewStore

func NewStore() *Store

NewStore creates new local content addressable storage.

func (*Store) Get

func (s *Store) Get(digest *rpb.Digest) (Data, bool)

Get gets data from store.

func (*Store) GetSource

func (s *Store) GetSource(digest *rpb.Digest) (Source, bool)

GetSource gets source from store.

func (*Store) List

func (s *Store) List() []*rpb.Digest

List lists known digests in cas.

func (*Store) Set

func (s *Store) Set(data Data)

Set sets data in store.