Documentation
¶
Overview ¶
Package orasutil is a collection of oras extensions
Index ¶
- Variables
- func NewExistenceCachedStorage(storage content.Storage) content.Storage
- func NewNoPushStorage(storage content.Storage) content.Storage
- type BlobCacher
- type CachedGraphTarget
- type CheckedStorage
- type ExistenceCachedStorage
- func (s *ExistenceCachedStorage) Exists(ctx context.Context, desc ocispec.Descriptor) (bool, error)
- func (s *ExistenceCachedStorage) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error)
- func (s *ExistenceCachedStorage) Push(ctx context.Context, desc ocispec.Descriptor, r io.Reader) error
- type UnreliableStorage
Constants ¶
This section is empty.
Variables ¶
var ErrMissingSuccessor = errors.New("missing successor")
ErrMissingSuccessor indicates that a success is issing.
Functions ¶
func NewExistenceCachedStorage ¶
NewExistenceCachedStorage adapts a content.Storage to cache results from Exists(), Push(), Fetch() to avoid unnecessary round-trips. This is sound so long as there are no concurrent deletes issued to the Storage through another interface.
Types ¶
type BlobCacher ¶
type BlobCacher struct {
// contains filtered or unexported fields
}
BlobCacher wraps oras interfaces ensuring they share a persistent blob cache.
func NewBlobCacher ¶
func NewBlobCacher(root string) (*BlobCacher, error)
NewBlobCacher returns a BlobCacher that utilizes a shared peristant file storage for all oras.GraphTargets that it creates. Safe to use if root does not yet exist.
func (*BlobCacher) GraphTarget ¶
func (bc *BlobCacher) GraphTarget(gt oras.GraphTarget) oras.GraphTarget
GraphTarget wraps an oras.GraphTarget with a shared peristant blob storage.
type CachedGraphTarget ¶
type CachedGraphTarget struct { oras.GraphTarget Cache orascontent.Storage }
CachedGraphTarget implements oras.GraphTarget, preferring to fetch blobs from a persistent cache and falling back to the remote if necessary.
func (*CachedGraphTarget) Fetch ¶
func (c *CachedGraphTarget) Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
Fetch prefers to read from the local cache, falling back to the remote on misses.
func (*CachedGraphTarget) Push ¶
func (c *CachedGraphTarget) Push(ctx context.Context, expected ocispec.Descriptor, content io.Reader) error
Push caches blobs while pushing to the remote.
type CheckedStorage ¶
type CheckedStorage struct {
Target oras.GraphTarget
}
CheckedStorage ensures that all successors are present before accepting a Push. This is to more closely mimic an OCI registry.
func (*CheckedStorage) Push ¶
func (cs *CheckedStorage) Push(ctx context.Context, expected ocispec.Descriptor, r io.Reader) error
Push implements content.Fetcher and overrides that in the embedded oras.Target.
type ExistenceCachedStorage ¶
ExistenceCachedStorage checks and populates the cache on calls to Exists(), Push(), Fetch().
func (*ExistenceCachedStorage) Exists ¶
func (s *ExistenceCachedStorage) Exists(ctx context.Context, desc ocispec.Descriptor) (bool, error)
Exists attempts to load the cached results of a previous call, falling back to the storage if not loaded.
func (*ExistenceCachedStorage) Fetch ¶
func (s *ExistenceCachedStorage) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error)
Fetch is instrumented with a cached existence check, used before fetching from the storage.
func (*ExistenceCachedStorage) Push ¶
func (s *ExistenceCachedStorage) Push(ctx context.Context, desc ocispec.Descriptor, r io.Reader) error
Push is instrumented with a cached existence check, used before pushing to the storage.
type UnreliableStorage ¶
UnreliableStorage overwrites the Exists function to consistently fetch manifests if the underlying content.GraphStorage cannot guarantee all successors also exist. Useful in a oras.CopyGraph context.
func (*UnreliableStorage) Exists ¶
func (u *UnreliableStorage) Exists(ctx context.Context, target ocispec.Descriptor) (bool, error)
Exists overwrites the underlying content.Storage's Exists by returning false if a descriptor has a manifest or index mediatype.