Documentation
¶
Overview ¶
Package ocifilter implements "filter" functions that wrap or combine ociregistry implementations in different ways.
Index ¶
- func AccessChecker(r ociregistry.Interface, check func(repoName string, access AccessKind) error) ociregistry.Interface
- func Immutable(r ociregistry.Interface) ociregistry.Interface
- func ReadOnly(r ociregistry.Interface) ociregistry.Interface
- func Select(r ociregistry.Interface, allow func(repoName string) bool) ociregistry.Interface
- func Sub(r ociregistry.Interface, pathPrefix string) ociregistry.Interface
- type AccessKind
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 ¶
func Immutable(r ociregistry.Interface) ociregistry.Interface
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 ¶
func ReadOnly(r ociregistry.Interface) ociregistry.Interface
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 ¶
func Sub(r ociregistry.Interface, pathPrefix string) ociregistry.Interface
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 )