mirror

package
v2.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

package mirror is used upload and download Bazel dependencies to and from a mirror.

Index

Constants

View Source
const (
	// DryRun is a flag to enable dry run mode.
	DryRun = true
	// Run is a flag to perform actual operations.
	Run = false
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Maintainer

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

Maintainer can upload and download files to and from a CAS mirror.

func New

func New(ctx context.Context, region, bucket, mirrorBaseURL string, dryRun bool, log *slog.Logger) (*Maintainer, error)

New creates a new Maintainer that can upload and download files to and from a CAS mirror.

func NewUnauthenticated

func NewUnauthenticated(mirrorBaseURL string, dryRun bool, log *slog.Logger) *Maintainer

NewUnauthenticated creates a new Maintainer that dose not require authentication can only download files from a CAS mirror.

func (*Maintainer) Check

func (m *Maintainer) Check(ctx context.Context, expectedHash string) error

Check checks if a file is present and has the correct hash in the CAS mirror.

func (*Maintainer) Learn

func (m *Maintainer) Learn(ctx context.Context, urls []string) (string, error)

Learn downloads a file from one of the existing (non-mirror) urls, hashes it and returns the hash.

func (*Maintainer) Mirror

func (m *Maintainer) Mirror(ctx context.Context, hash string, urls []string) error

Mirror downloads a file from one of the existing (non-mirror) urls and uploads it to the CAS mirror. It also calculates the hash of the file during streaming and checks if it matches the expected hash.

func (*Maintainer) MirrorURL

func (m *Maintainer) MirrorURL(hash string) (string, error)

MirrorURL returns the public URL of a file in the CAS mirror.

Jump to

Keyboard shortcuts

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