blobrefresh

package
Version: v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright (c) 2016-2019 Uber Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2016-2019 Uber Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPending     = errors.New("download is pending")
	ErrNotFound    = errors.New("blob not found")
	ErrWorkersBusy = errors.New("no workers available")
)

Refresher errors.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Limits the size of blobs which origin will accept. A 0 size limit means
	// blob size is unbounded.
	SizeLimit datasize.ByteSize `yaml:"size_limit"`
}

Config defines Refresher configuration.

type PostHook

type PostHook interface {
	Run(d core.Digest)
}

PostHook runs after the blob has been downloaded within the context of the deduplicated request.

type Refresher

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

Refresher deduplicates blob downloads / metainfo generation. Refresher is not responsible for tracking whether blobs already exist on disk -- it only provides a method for downloading blobs in a deduplicated fashion.

func New

func New(
	config Config,
	stats tally.Scope,
	cas *store.CAStore,
	backends *backend.Manager,
	metaInfoGenerator *metainfogen.Generator) *Refresher

New creates a new Refresher.

func (*Refresher) Refresh

func (r *Refresher) Refresh(namespace string, d core.Digest, hooks ...PostHook) error

Refresh kicks off a background goroutine to download the blob for d from the remote backend configured for namespace and generates metainfo for the blob. Returns ErrPending if an existing download for the blob is already running. Returns ErrNotFound if the blob is not found. Returns ErrWorkersBusy if no goroutines are available to run the download.

Jump to

Keyboard shortcuts

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