bottle

package
v1.15.16 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

Package bottle implements the local bottle handling functionality, providing facilities for:

- loading, storing, configuring, and validating bottle metadata (using external schema definition). - managing part information, synchronizing local and remote data as well as tracking part changes. - working with bottle and part labels and the local representation of part labels on local storage. - managing virtual parts (those that exist in a bottle, but have not been transferred locally due to selector use). - facilitating telemetry functionality with bottleID and telemetry events.

Index

Constants

View Source
const VirtTrackingFile = "vlayers.json"

VirtTrackingFile is the filename for local virtual parts tracking json file.

Variables

View Source
var (

	// ErrDirNotEmpty is return when a directory that is found not to be empty.
	ErrDirNotEmpty = errors.New("directory is not empty")

	// ErrPartInsecureArchive is an error that indicates that a part contains a directory archive but does not include
	// a trailing slash in the name. This can enable aliasing of files and directories by an attacker or otherwise, as
	// mentioned in https://git.act3-ace.com/ace/data/tool/-/issues/314
	ErrPartInsecureArchive = errors.New("part is named as regular file, but is an archived directory media type")
)
View Source
var ErrBottleAlreadyInit = errors.New("bottle already initialized")

ErrBottleAlreadyInit is the error received when trying to init an inited bottle.

View Source
var ErrDirNestedInBottle = errors.New("path is nested within bottle directory")

ErrDirNestedInBottle indicates that the destination of the bottle already has a bottle.

View Source
var ErrUnknownLayerMediaType = errors.New("unknown layer media type")

ErrUnknownLayerMediaType is the error if the layer media type is unknown.

Functions

func CheckIfCanInitialize

func CheckIfCanInitialize(bottlePath string, force bool) error

CheckIfCanInitialize examines the provided path and determines if the bottle is already initialized (allowing reinit if force is on), or if there is an error initializing.

func CopyFromCache

func CopyFromCache(ctx context.Context, btl *Bottle, desc ocispec.Descriptor, name string, btlPartMutex *sync.Mutex) (bool, error)

CopyFromCache copies a bottle part from the cache, handling extraction and decompression based on part mediatypes.

func CreateBottle

func CreateBottle(bottlePath string, overwrite bool) error

CreateBottle creates a bottle configuration yaml, including creating the path to the yaml file (as determined by the bottle library). It then determines if the set can be initialized, and if so, creates a new bottle config file.

func EntryFile

func EntryFile(path string) string

EntryFile returns a bottle configuration file path for a path name.

func FindBottleRootDir

func FindBottleRootDir(inputPath string) (string, error)

FindBottleRootDir checks if the current path is nested within a bottle, and returns the root directory of a bottle. If root bottle is not found, the function return the input path, along with an error.

func InspectBottleFiles

func InspectBottleFiles(ctx context.Context, btl *Bottle, opts Options) (string, bool, error)

InspectBottleFiles files iterates over all the files in a directory, including subdirectories, and determines if the files are cached, new, or updated. Returns a string containing bottle info if opts specifies display. Also returns a boolean that is true if files changed.

func ReadBottleIDFile

func ReadBottleIDFile(bottlePath string) (digest.Digest, error)

ReadBottleIDFile reads and parses the bottle id file of the bottle.

func SaveBottleConfig

func SaveBottleConfig(btl *Bottle) error

SaveBottleConfig saves a json representation of the bottle to the local bottle configuration directory.

func SaveBottleID

func SaveBottleID(btl *Bottle) error

SaveBottleID writes a bottle id as "<algorithm>:<digest>" to the bottle's bottleid file.

func SaveBottleIDFile

func SaveBottleIDFile(btl *Bottle, path string) error

SaveBottleIDFile writes a bottle id as "<algorithm>:<digest>" to a given file.

func SaveBottleManifest

func SaveBottleManifest(btl *Bottle) error

SaveBottleManifest writes a bottle's manifest as raw json to the bottle's manifest file (.dt/manifest.json).

func SaveExtraBottleInfo

func SaveExtraBottleInfo(ctx context.Context, btl *Bottle) error

SaveExtraBottleInfo saves the bottle ID and config JSON and the pull command used This data is never read by ace-dt and is only saved as a convenience to the user.

func SavePullCmd

func SavePullCmd(ctx context.Context, btl *Bottle) error

SavePullCmd writes a pull command using the bottle digest as source, and including part selectors if there are any virtual parts. This function is safe to call in any bottle command, and will log any errors instead of returning them.

func SaveUpdatesToSet

func SaveUpdatesToSet(ctx context.Context, btl *Bottle, options SaveOptions) error

SaveUpdatesToSet performs archival, digest, and cache commission to bottle components, and saves bottle metadata.

func SigDir

func SigDir(path string) string

SigDir returns a bottle signature directory from bottle dir.

func VerifyPullDir

func VerifyPullDir(destdir string) error

VerifyPullDir performs checks on the bottle destination path to ensure that it meets the expected criteria.

func WithVirtualParts

func WithVirtualParts(btl *Bottle) error

WithVirtualParts populates a virtual part tracker with virtual part information found in a bottle config directory.

Types

type BOption

type BOption func(*Bottle) error

BOption defines a function that operates on a Bottle to configure options A variadic list fo BottleOptions is provided to the Bottle constructor to set desired options (and use defaults for the rest).

func DisableCache

func DisableCache(disable bool) BOption

DisableCache sets or clears a flag that optionally disables the usage of cache storage. This is primarily intended for use when no data transfer is expected for bottle items (such as when performing a remote query).

func DisableDestinationCreate

func DisableDestinationCreate(disable bool) BOption

DisableDestinationCreate sets or clears a flag that optionally disables the creation of an output path before transfer. This only pertains to Bottle downloads.

func WithBlobInfoCache

func WithBlobInfoCache(bicPath string) BOption

WithBlobInfoCache defines a file path where a blob info cache is discovered or created, usually this will be in the cache path. If an empty string is provided, a memory based BIC will be used.

func WithCachePath

func WithCachePath(pth string) BOption

WithCachePath defines a file path where Bottle blobs are stored during download and upload.

func WithLocalLabels

func WithLocalLabels() BOption

WithLocalLabels populates the bottle label provider with the labels found in .labels.yaml files on the filesystem, located in the provided path.

func WithLocalPartFile

func WithLocalPartFile(jsonPartFile string) BOption

WithLocalPartFile specifies a local part file path for reading local part metadata, this function does not update the bottle definition with the part information, use SyncDefinitionParts after calling this if needed.

func WithLocalPath

func WithLocalPath(pth string) BOption

WithLocalPath defines a local path for a Bottle, which can be the destination for a download or source for upload.

type Bottle

type Bottle struct {
	Manifest oci.ManifestHandler

	// Definition is the bottle configuration.
	// Outside of methods of this package, Definition must not be modified
	Definition cfgdef.Bottle

	// OriginalManifest is the manifest that was pulled
	OriginalManifest []byte

	// OriginalConfig is the config that was pulled
	OriginalConfig []byte

	// Parts is the complete list of parts (local and virtual) for this bottle
	Parts []PartTrack

	VirtualPartTracker   *VirtualParts
	DisableCreateDestDir bool
	// contains filtered or unexported fields
}

Bottle represents a bottle and associated options for managing data transfer. The options are set using BottleOption functional options in a call to NewBottle constructor.

func LoadBottle

func LoadBottle(path string, opts ...BOption) (*Bottle, error)

LoadBottle attempts to load an existing bottle configuration from the provided bottle path. opts provides a method to override the default bottle configuration. LocalPath and YAML file options will be set by the path argument, so will not need to be supplied.

func NewBottle

func NewBottle(options ...BOption) (*Bottle, error)

NewBottle creates a new Bottle and prepares it for transfer using the Bottle.Get function. The created bottle is configured with the options provided, which are any number of functional options. For functionality, at least remote source and local path should be defined in the option list. If not disabled, the output directory is created during construction.

func NewReadOnlyBottle

func NewReadOnlyBottle() (*Bottle, error)

NewReadOnlyBottle creates a bottle without initializing any features that would produce side effects, such as creating directories, initializing authentication, performing local metadata initializations. Despite the name, a read only bottle can be modified after creation, such as configuring with config data or modifying bottle settings directly.

func (*Bottle) AddAnnotation

func (btl *Bottle) AddAnnotation(k, v string)

AddAnnotation adds input key, and value to a bottle annotations map in the bottle schema.

func (*Bottle) AddArtifact

func (btl *Bottle) AddArtifact(name, pth, mediaType string, dgst digest.Digest) error

AddArtifact adds a public artifact to the bottle definition. The artifact is keyed on a path. If the artifact passed in is found in the definition, the item is updated. If no changes are found, then the function returns without making any changes to the bottle definition. If a field of the bottle is invalid, an error is returned.

func (*Bottle) AddAuthorInfo

func (btl *Bottle) AddAuthorInfo(authorIn cfgdef.Author) error

AddAuthorInfo adds an authors to the bottle's list of authors If the name or the email being added matches an existing author that author entry is updated Returns an error when input is invalid.

func (*Bottle) AddLabel

func (btl *Bottle) AddLabel(k, v string)

AddLabel adds a label to the bottle.

func (*Bottle) AddMetricInfo

func (btl *Bottle) AddMetricInfo(metricIn cfgdef.Metric) error

AddMetricInfo adds a metric to the bottle's list of metrics. If the name of the input metric matches an already present metrics, then the metric is updated. Return an error if the input metric fails validation.

func (*Bottle) AddPartLabel

func (btl *Bottle) AddPartLabel(ctx context.Context, key, value, partPath string) error

AddPartLabel adds a label to a part listed in the bottle. Part labels are added to LocalPart labels map, then synced to the bottle definitions.

func (*Bottle) AddPartMetadata

func (btl *Bottle) AddPartMetadata(name string,
	contentSize int64, contentDigest digest.Digest,
	layerSize int64, layerDigest digest.Digest,
	mediaType string,
	modtime time.Time,
)

AddPartMetadata adds information about a part to the bottle.

func (*Bottle) AddSourceInfo

func (btl *Bottle) AddSourceInfo(sourceIn cfgdef.Source) error

AddSourceInfo adds a source to the bottle's list of sources If the name or the uri matches an already available source, then the item is updated. Return an error if the input source fails validation.

func (*Bottle) BIC

func (btl *Bottle) BIC() cache.BIC

BIC returns the BlobInfoCache.

func (*Bottle) CalculatePublicArtifactDigest

func (btl *Bottle) CalculatePublicArtifactDigest(index int) error

CalculatePublicArtifactDigest updates the artifact at the specified index with the digest of the corresponding file.

func (*Bottle) ConfigDescriptor

func (btl *Bottle) ConfigDescriptor() (ocispec.Descriptor, error)

ConfigDescriptor returns an oci descriptor for a bottle config, as it corresponds to the config in a manifest.

func (*Bottle) Configure

func (btl *Bottle) Configure(cfgData []byte) error

Configure configures a Bottle based on cfgData provided as a slice of bytes. cfgData should be the full bottle configuration as JSON. if it is not then you ust call btl.invalidateConfiguration() after calling Configure().

func (*Bottle) ConfigureFromFile

func (btl *Bottle) ConfigureFromFile(filePath string) error

ConfigureFromFile reads bottle configuration from the filename provided. This is the entry.yaml file containing metadata, but NOT including part data. For a complete bottle, the parts.json file should be loaded as well (such as with WithLocalPartFile(partFileName)(btl) ).

func (*Bottle) ConstructManifest

func (btl *Bottle) ConstructManifest() error

ConstructManifest creates a ManifestHandler that corresponds to the data within a bottle, including configuration, part descriptors (layers), and annotations. This is a representation from an oci level, so part descriptors are at the oci layer level (archived/compressed) and not at the bottle level. The manifest handler that is stored within the bottle.

func (*Bottle) DeprecateBottleID

func (btl *Bottle) DeprecateBottleID(bottleID digest.Digest)

DeprecateBottleID adds given bottleID to the bottle's deprecates slice.

func (*Bottle) GetBottleID

func (btl *Bottle) GetBottleID() digest.Digest

GetBottleID returns a digest for the bottle configuration.

func (*Bottle) GetBottleManifest

func (btl *Bottle) GetBottleManifest() ([]byte, error)

GetBottleManifest returns a digest for the bottle configuration.

func (*Bottle) GetCache

func (btl *Bottle) GetCache() orascontent.GraphStorage

GetCache returns a oras content.GraphStorage interface for working with local cache data.

func (*Bottle) GetConfigPath

func (btl *Bottle) GetConfigPath() string

GetConfigPath returns a path to the bottle's OCI config, i.e. '.config.json'. To get the path for the configuration in entry.yaml use EntryFile().

func (*Bottle) GetConfiguration

func (btl *Bottle) GetConfiguration() ([]byte, error)

GetConfiguration returns a byte slice containing json formatted configuration data for the bottle.

func (*Bottle) GetManifestAnnotations

func (btl *Bottle) GetManifestAnnotations() map[string]string

GetManifestAnnotations returns the expiration time of a bottle that is set during bottle push Needed to comply with the LocalData interface.

func (*Bottle) GetManifestArtifactType

func (btl *Bottle) GetManifestArtifactType() string

GetManifestArtifactType returns the artifact type for a bottle. Currently, this is a constant string based on the schema bottle media type.

func (*Bottle) GetManifestPath

func (btl *Bottle) GetManifestPath() string

GetManifestPath returns a path to the bottle's OCI manifest, i.e. '.manifest.json'.

func (*Bottle) GetPartByLayerDescriptor

func (btl *Bottle) GetPartByLayerDescriptor(descriptor ocispec.Descriptor) PartInfo

GetPartByLayerDescriptor returns a PartInfo for a part based on a descriptor from a manifest, matching by digest.

func (*Bottle) GetPartByName

func (btl *Bottle) GetPartByName(partName string) PartInfo

GetPartByName returns a single FileInfo matching the provided name.

func (*Bottle) GetPartStatus

func (btl *Bottle) GetPartStatus(ctx context.Context, search PartTrack) PartStatus

GetPartStatus looks for an existing file entry based on the search file entry information, and returns a status bitfield.

func (*Bottle) GetParts

func (btl *Bottle) GetParts() []PartInfo

GetParts returns a slice of PartTrack structures presented as a slice of FileInfo interfaces.

func (*Bottle) GetPath

func (btl *Bottle) GetPath() string

GetPath returns a string representing the local path for the Bottle.

func (*Bottle) LoadLocalLabels

func (btl *Bottle) LoadLocalLabels() error

LoadLocalLabels loads labels files.

func (*Bottle) NativePath

func (btl *Bottle) NativePath(pth string) string

NativePath converts the bottle relative UNIX path to a host native path This is the inverse of partName(). e.g., nativePath(partName("/foo/bar")) == "/foo/bar".

func (*Bottle) NumParts

func (btl *Bottle) NumParts() int

NumParts returns the number of parts in the bottle.

func (*Bottle) PartDescriptors

func (btl *Bottle) PartDescriptors() ([]ocispec.Descriptor, error)

PartDescriptors generates a list of oci descriptors for bottle parts, which correspond to parts as they are represented in a manifest.

func (*Bottle) RemoveAnnotation

func (btl *Bottle) RemoveAnnotation(k string) error

RemoveAnnotation removes the annotation associated with the input key. Returns an error if the key is not found in annotation map of bottle schema.

func (*Bottle) RemoveArtifact

func (btl *Bottle) RemoveArtifact(pth string) error

RemoveArtifact removes a public artifact from the bottle definition. It looks for the provided path in the public artifact's definition. If the specified path is not found, then an error is returned.

func (*Bottle) RemoveAuthorInfo

func (btl *Bottle) RemoveAuthorInfo(name string) error

RemoveAuthorInfo removes author information from the bottle's definition using author's name as a key. If name is not found, then an error is returned.

func (*Bottle) RemoveLabel

func (btl *Bottle) RemoveLabel(k string) error

RemoveLabel removes the label associated with the input key. Returns an error if the key is not found in labels map of bottle schema.

func (*Bottle) RemoveMetricInfo

func (btl *Bottle) RemoveMetricInfo(metricName string) error

RemoveMetricInfo removes the metric with specified name from the bottle. If the metric is not found, then an error is returned to the caller.

func (*Bottle) RemovePartLabel

func (btl *Bottle) RemovePartLabel(ctx context.Context, key, partPath string) error

RemovePartLabel removes a label from a part using the provided key.

func (*Bottle) RemovePartMetadata

func (btl *Bottle) RemovePartMetadata(name string)

RemovePartMetadata removes a file record from a Bottle files list.

func (*Bottle) RemoveSourceInfo

func (btl *Bottle) RemoveSourceInfo(name string) error

RemoveSourceInfo removes a source from the bottle's list of sources if the name is not found, then we return an error to the caller.

func (*Bottle) Save

func (btl *Bottle) Save() error

Save writes the bottle information to the local disk based on internal path information, in yaml format. if saveJson is true a json version of the data is saved as well.

func (*Bottle) ScratchPath

func (btl *Bottle) ScratchPath() string

ScratchPath returns the directory (guaranteed to exist) or cache local temporary files.

func (*Bottle) SetDescription

func (btl *Bottle) SetDescription(content string)

SetDescription add or update the description of a bottle.

func (*Bottle) SetManifest

func (btl *Bottle) SetManifest(manifest oci.ManifestHandler)

SetManifest sets a bottle's manifest to the provided ManifestHandler.

func (*Bottle) SetRawManifest

func (btl *Bottle) SetRawManifest(inData []byte)

SetRawManifest retains the provided raw manifest data in the bottle for future reference.

func (*Bottle) Touch

func (btl *Bottle) Touch()

Touch marks all file entries with the file system reported time if the part exists and can be accessed. The modtime information is only updated if the existing modified time is earlier than the time reported by the filesystem.

func (*Bottle) UpdatePartMetadata

func (btl *Bottle) UpdatePartMetadata(name string,
	contentSize int64, contentDigest digest.Digest,
	lbls map[string]string,
	layerSize int64, layerDigest digest.Digest,
	mediaType string,
	modtime *time.Time,
)

UpdatePartMetadata changes the metadata for the part identified by name.

func (*Bottle) VerifyBottleID

func (btl *Bottle) VerifyBottleID(matchBottleID digest.Digest) error

VerifyBottleID verifies that the bottle ID matched what is passed in. The algorithm in the matchBottleID is used to compute the digest of the bottle config.

type Options

type Options struct {
	// WantDetails enables directory tree walking for gathering files changed within directories
	WantDetails bool

	// Visitor is a delegate for processing individual file infos with status indicators, set to null to perform a default Display action
	Visitor Visitor
}

Options define a set of options for processing file statuses.

type PartInfo

type PartInfo interface {
	// GetName returns a file name
	GetName() string
	// GetContentSize returns the size of a file in the bottle config (uncompressed, unarchived form)
	GetContentSize() int64
	// GetContentDigest returns the digest of a file as it exists in uncompressed/unarchived state, and is the digest
	// referened in bottle config
	GetContentDigest() digest.Digest
	// GetLabels returns a map of label keys to values associated with a file
	GetLabels() labels.Set

	// GetLayerSize is the size of the layer (often compresses size)
	GetLayerSize() int64
	// GetLayerDigest returns the digest of a file, as stored in cache or on the server.  This can be the compressed and/or
	// archived form of the file, and in OCI terms is the LayerDigest
	GetLayerDigest() digest.Digest
	// GetMediaType returns the content media type string for a file
	GetMediaType() string

	// GetModTime returns the last known modified time of a file, and can be used to determine if a file on disk has
	// been modified since the last bottle operation
	GetModTime() time.Time
}

PartInfo is an interface for oci file entry data retrieval.

type PartSelectorFunc

type PartSelectorFunc func(PartInfo) bool

PartSelectorFunc is a function that returns true if the part should be included in the download.

type PartSelectorOptions

type PartSelectorOptions struct {
	Empty     bool     // Only pull metadata from the bottle
	Labels    []string // Label selectors to apply
	Names     []string // Names of parts to retrieve
	Artifacts []string // Filter by public artifact type
}

PartSelectorOptions are options for creating a PartSelector.

func (*PartSelectorOptions) New

New creates a new PartSelectorFunc from the options.

type PartStatus

type PartStatus uint8

PartStatus is a bitmask for file status flags.

const (
	// StatusExists indicates a file that is tracked.
	StatusExists PartStatus = 1 << iota
	// StatusCached indicates a file that exists in the cache based on the
	// digest stored in the Bottle.
	StatusCached
	// StatusChanged indicates a file that has been modified more recently
	// than the entry known last update.
	StatusChanged
	// StatusDigestMatch indicates a digest match.
	StatusDigestMatch
	// StatusNew indicates a discovered file that is currently untracked.
	StatusNew
	// StatusDeleted indicates tracked file that is no longer discovered.
	StatusDeleted
	// StatusVirtual indicates tracked file that is not stored locally, e.g. excluded with a selector on pull.
	StatusVirtual
)

type PartTrack

type PartTrack struct {
	cfgdef.Part
	LayerSize   int64         `json:"layerSize"`
	LayerDigest digest.Digest `json:"layerDigest"`
	MediaType   string        `json:"mediaType"`

	Modified time.Time `json:"modified"`
}

PartTrack is a superset of the bottle definition part entry, and provides additional fields for tracking information and changes to parts. PartTrack structures implement the oci.FileInfo interface for inspecting part information.

func (*PartTrack) GetContentDigest

func (p *PartTrack) GetContentDigest() digest.Digest

GetContentDigest returns the digest of the content (tar file, uncompressed) of the part implements oci.FileInfo interface.

func (*PartTrack) GetContentSize

func (p *PartTrack) GetContentSize() int64

GetContentSize for PartTrack returns the size from the part track's part definition. This size is the original part size.

func (*PartTrack) GetLabels

func (p *PartTrack) GetLabels() labels.Set

GetLabels implements oci.FileInfo.

func (*PartTrack) GetLayerDigest

func (p *PartTrack) GetLayerDigest() digest.Digest

GetLayerDigest for PartEntry implements storage.FileInfo interface, returning the digest for the part as represented by a layer when transformed to the part format.

func (*PartTrack) GetLayerSize

func (p *PartTrack) GetLayerSize() int64

GetLayerSize returns the size of the layer (compresses size).

func (*PartTrack) GetMediaType

func (p *PartTrack) GetMediaType() string

GetMediaType for PartTrack implements the GetFormat portion of the oci.FileInfo interface, returning the file entry format. This format is the "network format" for the part, which is a potentially tarred/compressed/encrypted manifestation of the part, and not the on-disk format of the part files.

func (*PartTrack) GetModTime

func (p *PartTrack) GetModTime() time.Time

GetModTime for PartTrack implements GetModified portion of the oci.FileInfo interface, returning the modified time for a part.

func (*PartTrack) GetName

func (p *PartTrack) GetName() string

GetName returns the name of the part implements oci.FileInfo interface.

func (*PartTrack) SetLayerDigest

func (p *PartTrack) SetLayerDigest(dgst digest.Digest)

SetLayerDigest sets a layer digest based on string format for a part.

func (*PartTrack) SetLayerSize

func (p *PartTrack) SetLayerSize(sz int64)

SetLayerSize sets the layer size information for a part.

func (*PartTrack) SetMediaType

func (p *PartTrack) SetMediaType(mt string)

SetMediaType sets the media type string for a part.

func (*PartTrack) SetModTime

func (p *PartTrack) SetModTime(mtime time.Time)

SetModTime sets modified time information for a part.

type SaveOptions

type SaveOptions struct {
	NoArchive     bool
	NoDigest      bool
	NoCommit      bool
	CompressLevel string
}

SaveOptions is a structure for supplying options to the SaveUpdatesToSet function. By default, all options are "on", eg, the options to disable functions are all false.

type VirtRecord

type VirtRecord struct {
	LayerID   digest.Digest `json:"layer-id"`
	ContentID digest.Digest `json:"content-id"`
}

A VirtRecord is a structure for tracking data for an individual virtual part, containing LayerID, ContentID, and a Location reference where the Layer can be found or retrieved. Content and Layer IDs are stored in digest format; with the algorithm included.

type VirtualParts

type VirtualParts struct {
	VirtRecords []VirtRecord `json:"virt-records"`
	// contains filtered or unexported fields
}

VirtualParts represents a set of local bottle part metadata that tracks parts that are not stored in a local copy of a bottle. Virtual parts are added to this collection when a pull uses a selector that excludes parts. Each virtual part is identified by a content ID, layer ID, and a reference where the bottle can be retrieved.

func NewVirtualPartTracker

func NewVirtualPartTracker(basePath string) *VirtualParts

NewVirtualPartTracker initializes a VirtualParts object and loads any existing data from disk.

func (*VirtualParts) Add

func (vp *VirtualParts) Add(layerID digest.Digest, contentID digest.Digest)

Add adds a layer/content and location reference for a layer to the collection.

func (*VirtualParts) HasContent

func (vp *VirtualParts) HasContent(digest digest.Digest) bool

HasContent returns true if the virtual parts collection contains the specified content digest.

func (*VirtualParts) HasLayer

func (vp *VirtualParts) HasLayer(digest digest.Digest) bool

HasLayer returns true if the virtual parts collection contains the specified layer digest.

func (*VirtualParts) Load

func (vp *VirtualParts) Load() error

Load loads virtual part tracking data from disk.

func (*VirtualParts) Save

func (vp *VirtualParts) Save() error

Save writes virtual file data to disk,.

type Visitor

type Visitor func(PartInfo, PartStatus) (bool, error)

Visitor is a function delegate for performing an action based on a provided file info and status indicator return true to halt processing, or false to continue.

func PrepareUpdatedParts

func PrepareUpdatedParts(ctx context.Context, btl *Bottle) Visitor

PrepareUpdatedParts performs bottle part processing as a delegate when scanning for changed parts. The bottle information is updated with the changed data, preserving existing data where possible. Mostly, this involves removing file entries, resetting file entries (removing size/digest to trigger recalc), and adding file entries.

Directories

Path Synopsis
Package label handles part label files
Package label handles part label files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳