digest

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

Package digest handles content digest for remote executon API, https://github.com/bazelbuild/remote-apis/blob/c1c1ad2c97ed18943adb55f06657440daa60d833/build/bazel/remote/execution/v2/remote_execution.proto#L633

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultViews = []*view.View{
		{
			Name:        "go.chromium.org/goma/server/remoteexec/digest.cache-entries",
			Description: `number of digest cache entries`,
			Measure:     cacheStats,
			Aggregation: view.Sum(),
		},
		{
			Name:        "go.chromium.org/goma/server/remoteexec/digest.cache-ops",
			Description: `digest cache operations`,
			Measure:     cacheStats,
			TagKeys: []tag.Key{
				opKey,
				fileExtKey,
			},
			Aggregation: view.Count(),
		},
	}
)

Functions

This section is empty.

Types

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
	Source
}

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.

Jump to

Keyboard shortcuts

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