...

Package ocifilter

import "cuelabs.dev/go/oci/ociregistry/ocifilter"
Overview
Index

Overview ▾

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

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