rbe

package
v0.1.23-oss Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TranslateDirectory

func TranslateDirectory(dir *repb.Directory, idStore IdentityStore, currentDigest digest.Digest, gitlinks map[digest.Digest]entities.Hash, sha1Map map[digest.Digest]entities.Hash) ([]byte, []remote.BundledObject, error)

TranslateDirectory converts an RBE Directory proto into ABFS tree bytes, primes the IdentityStore with mappings for all children and returns a list of "bundled" blobs (like symlink targets).

Types

type BadgerIdentityStore

type BadgerIdentityStore struct {
	// contains filtered or unexported fields
}

func NewBadgerIdentityStore

func NewBadgerIdentityStore(path string) (*BadgerIdentityStore, error)

NewBadgerIdentityStore creates and opens a new IdentityStore backed by BadgerDB.

func (*BadgerIdentityStore) Close

func (s *BadgerIdentityStore) Close() error

Close closes the underlying BadgerDB instance.

func (*BadgerIdentityStore) Get

Get retrieves the RBE node associated with a SHA-1 hash.

func (*BadgerIdentityStore) Put

func (s *BadgerIdentityStore) Put(sha1 entities.Hash, node model.Node) error

Put records a mapping from a SHA-1 hash to an RBE node.

func (*BadgerIdentityStore) PutMany

func (s *BadgerIdentityStore) PutMany(entries []IdentityEntry) error

PutMany records multiple mappings from SHA-1 hashes to RBE nodes using WriteBatch.

type IdentityEntry

type IdentityEntry struct {
	SHA1 entities.Hash
	Node model.Node
}

IdentityEntry represents a single mapping between a SHA-1 hash and an RBE node.

func TranslateDirectoryEntries

func TranslateDirectoryEntries(dir *repb.Directory, currentDigest digest.Digest, gitlinks map[digest.Digest]entities.Hash, sha1Map map[digest.Digest]entities.Hash) ([]byte, []remote.BundledObject, []IdentityEntry, error)

TranslateDirectoryEntries converts an RBE Directory proto into ABFS tree bytes, extracts identity store mapping entries without writing to the store directly, and returns a list of "bundled" blobs (like symlink targets).

type IdentityStore

type IdentityStore interface {
	// Put records a mapping from a SHA-1 hash to an RBE node (digest + type).
	Put(sha1 entities.Hash, node model.Node) error

	// PutMany records multiple mappings from SHA-1 hashes to RBE nodes in batches.
	PutMany(entries []IdentityEntry) error

	// Get retrieves the RBE node associated with a SHA-1 hash.
	// Returns (node, true, nil) if found, (empty, false, nil) if not found.
	Get(sha1 entities.Hash) (model.Node, bool, error)

	// Close closes the underlying storage.
	Close() error
}

IdentityStore provides a shared mapping layer between ABFS SHA-1 hashes and RBE digests (SHA-256 + Size).

type RBEClient

type RBEClient struct {
	// contains filtered or unexported fields
}

RBEClient implements the remote.RemoteProvider interface using an RBE backend. It uses an IdentityStore to map ABFS SHA-1 hashes to RBE SHA-256 digests.

func NewRBEClient

func NewRBEClient(rbeClient *rexec.Client, idStore IdentityStore) *RBEClient

NewRBEClient creates a new RBEClient.

func (*RBEClient) AddMapResult

func (c *RBEClient) AddMapResult(ctx context.Context, from, to entities.Hash) error

AddMapResult delegates to fallback.

func (*RBEClient) Close

func (c *RBEClient) Close() error

func (*RBEClient) GetObject

func (c *RBEClient) GetObject(ctx context.Context, key entities.Hash) (remote.ContentReadCloser, error)

GetObject fulfills a SHA-1 request by resolving it via the IdentityStore and fetching from RBE.

func (*RBEClient) GetRefs

func (c *RBEClient) GetRefs(ctx context.Context, server string, project string, refs []string) ([]entities.Hash, error)

GetRefs delegates to fallback.

func (*RBEClient) Headers

func (c *RBEClient) Headers(ctx context.Context, keys []entities.Hash) ([]entities.ObjectHeader, error)

Headers returns metadata for the provided keys by resolving them via the IdentityStore.

func (*RBEClient) MapResults

func (c *RBEClient) MapResults(ctx context.Context, from entities.Hash) ([]entities.Hash, error)

MapResults delegates to fallback.

func (*RBEClient) Mark

func (c *RBEClient) Mark(ctx context.Context, hash entities.Hash, key, value string) (int64, error)

Mark delegates to fallback.

func (*RBEClient) PutObject

func (c *RBEClient) PutObject(ctx context.Context, key entities.Hash, reader remote.ContentReadCloser) error

PutObject uploads an object to RBE and records the SHA-1 -> SHA-256 mapping.

func (*RBEClient) PutRefs

func (c *RBEClient) PutRefs(ctx context.Context, server string, project string, refs []entities.RefHash) error

PutRefs delegates to fallback.

func (*RBEClient) SHA256

func (c *RBEClient) SHA256(ctx context.Context, keys []entities.Hash) ([]entities.SHA256, error)

SHA256 is unimplemented.

func (*RBEClient) SearchRefs

func (c *RBEClient) SearchRefs(ctx context.Context, server string, project string, refPrefix string, limit int) ([]entities.ProjectRefHash, error)

SearchRefs delegates to fallback.

func (*RBEClient) Version

func (c *RBEClient) Version(ctx context.Context) (string, error)

Version returns version information.

func (*RBEClient) WhoAmI

func (c *RBEClient) WhoAmI(ctx context.Context) (string, error)

WhoAmI returns identity information.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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