ocifilter

package
v0.0.0-...-eedc705 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package ocifilter implements "filter" functions that wrap or combine ociregistry implementations in different ways.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessChecker

func AccessChecker(r ociregistry.Interface, check func(repoName string, access AccessKind) error) ociregistry.Interface

AccessChecker returns a wrapper for r that invokes check to check access before calling an underlying method. Only if check succeeds will the underlying method be called.

The check function is invoked with the name of the repository being accessed (or "*" for Repositories), and the kind of access required. For some methods (e.g. Mount), check might be invoked more than once for a given repository.

When invoking the Repositories method, check is invoked for each repository in the iteration - the repository will be omitted if check returns an error.

func Immutable

Immutable returns a registry wrap r but only allows content to be added but not changed once added: nothing can be deleted and tags can't be changed.

func ReadOnly

ReadOnly returns a registry implementation that returns an "operation unsupported" error from all entry points that mutate the registry.

func Select

func Select(r ociregistry.Interface, allow func(repoName string) bool) ociregistry.Interface

Select returns a wrapper for r that provides only repositories for which allow returns true.

Requests for disallowed repositories will return ErrNameUnknown errors on read and ErrDenied on write.

func Sub

Sub returns r wrapped so that it addresses only repositories within pathPrefix.

The prefix must match an entire path element so, for example, if the prefix is "foo", "foo" and "foo/a" will be included, but "foobie" will not.

For example, if r has the following repositories:

a
a/b/c
a/d
x/p
aa/b

then Sub(r "a") will return a registry containing the following repositories:

b/c
d

Types

type AccessKind

type AccessKind int

AccessKind

const (
	// [ociregistry.Reader] methods.
	AccessRead AccessKind = iota

	// [ociregistry.Writer] methods.
	AccessWrite

	// [ociregistry.Deleter] methods.
	AccessDelete

	// [ociregistry.Lister] methods.
	AccessList
)

Jump to

Keyboard shortcuts

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