Back to godoc.org

Package digest

v0.0.15
Latest Go to latest

The latest major version is .

Published: Jul 31, 2020 | License: BSD-3-Clause | Module: go.chromium.org/goma/server

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

Variables

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(),
		},
	}
)

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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier