storage

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Seen

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

Seen is used to keep track of all blobs we have already seen across all stored images.

func NewSeen

func NewSeen() *Seen

func (*Seen) Add

func (s *Seen) Add(blobDigest digest.Digest, blobInfo types.BlobInfo)

Add adds a blob to the seen list.

func (*Seen) Get

func (s *Seen) Get(blobDigest digest.Digest) (types.BlobInfo, bool)

Remove gets a blob info from the seen list.

type Storage

type Storage struct {
	types.ImageReference
	// contains filtered or unexported fields
}

Storage handles the storage of multiple images. It is used to store multiple images in a single directory while deduplicating blobs.

func New

func New(basedir string) *Storage

New returns a reference to a Storage using provided directory as base (root). Property "seen" is used to we keep track of all blobs we have already seen across all stored images.

func (*Storage) CurrentImage

func (t *Storage) CurrentImage() string

CurrentImage returns the inner image we are operating on.

func (*Storage) DeleteBlob

func (t *Storage) DeleteBlob(name string) error

DeleteBlob deletes a blob from the current Storage. The file name must be a blob file name, i.e. a file name that is a valid digest.

func (*Storage) Files

func (t *Storage) Files() (map[string]os.FileInfo, error)

Files returns a list of all files stored in the Storage, includes files in all Images.

func (*Storage) Image

func (t *Storage) Image(image string) error

Image sets the current inner Image inside the Storage. A Storage allows "write to" and "read from" on a single Image at a given time. Creates or uses an already existent subdirectory named after the Image name.

func (*Storage) Images

func (t *Storage) Images() ([]string, error)

Images list all images stored in the Storage. Traverses the Storage base directory and returns all subdirectories that do not contain a subdir or name starts with ".".

func (*Storage) NewImageDestination

func (t *Storage) NewImageDestination(
	ctx context.Context, sys *types.SystemContext,
) (types.ImageDestination, error)

NewImageDestination returns a handler used to write to the current Image. Current image must be already set by the caller (using Image() function).

func (*Storage) NewImageSource

func (t *Storage) NewImageSource(
	ctx context.Context, sys *types.SystemContext,
) (types.ImageSource, error)

NewImageSource returns a handler used to read from the Storage current Image. Current image must already be set by caller by means of a call to Image function.

Jump to

Keyboard shortcuts

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