namepath

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: Apache-2.0 Imports: 5 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.

Index

Constants

View Source
const (
	DockerTag         = "docker_tag"
	ShardedDockerBlob = "sharded_docker_blob"
	Identity          = "identity"
)

Pather id strings.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerTagPather

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

DockerTagPather generates paths for Docker tags.

func (DockerTagPather) BasePath

func (p DockerTagPather) BasePath() string

BasePath returns the docker registry repositories prefix.

func (DockerTagPather) BlobPath

func (p DockerTagPather) BlobPath(name string) (string, error)

BlobPath interprets name as a "repo:tag" and generates a registry path for it.

func (DockerTagPather) NameFromBlobPath

func (p DockerTagPather) NameFromBlobPath(bp string) (string, error)

NameFromBlobPath converts a tag path back into repo:tag format.

type IdentityPather

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

IdentityPather is the identity Pather.

func (IdentityPather) BasePath

func (p IdentityPather) BasePath() string

BasePath returns the root.

func (IdentityPather) BlobPath

func (p IdentityPather) BlobPath(name string) (string, error)

BlobPath always returns root/name.

func (IdentityPather) NameFromBlobPath

func (p IdentityPather) NameFromBlobPath(bp string) (string, error)

NameFromBlobPath strips the root from bp.

type Pather

type Pather interface {
	// BasePath returns the base path of where blobs are stored.
	BasePath() string

	// BlobPath converts name into a blob path.
	BlobPath(name string) (string, error)

	// NameFromBlobPath converts blob path bp back into the original blob name.
	NameFromBlobPath(bp string) (string, error)
}

Pather defines an interface for converting names into paths.

func New

func New(root, id string) (Pather, error)

New creates a Pather scoped to root.

type ShardedDockerBlobPather

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

ShardedDockerBlobPather generates sharded paths for Docker blobs.

func (ShardedDockerBlobPather) BasePath

func (p ShardedDockerBlobPather) BasePath() string

BasePath returns the docker registry blobs prefix.

func (ShardedDockerBlobPather) BlobPath

func (p ShardedDockerBlobPather) BlobPath(name string) (string, error)

BlobPath interprets name as a SHA256 digest and returns a registry path which is sharded by the first two bytes.

func (ShardedDockerBlobPather) NameFromBlobPath

func (p ShardedDockerBlobPather) NameFromBlobPath(bp string) (string, error)

NameFromBlobPath converts a sharded blob path back into raw hex format.

Jump to

Keyboard shortcuts

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