Documentation ¶
Overview ¶
Package prioritize provides utilities for filtering and prioritizing locations in types.BlobInfoCache.CandidateLocations.
Index ¶
- func CandidateCompression(v2Options *blobinfocache.CandidateLocations2Options, digest digest.Digest, ...) (bool, types.LayerCompression, *compression.Algorithm)
- func DestructivelyPrioritizeReplacementCandidates(cs []CandidateWithTime, primaryDigest, uncompressedDigest digest.Digest) []blobinfocache.BICReplacementCandidate2
- type CandidateWithTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CandidateCompression ¶ added in v5.31.0
func CandidateCompression(v2Options *blobinfocache.CandidateLocations2Options, digest digest.Digest, compressorName string) (bool, types.LayerCompression, *compression.Algorithm)
CandidateCompression returns (true, compressionOp, compressionAlgo) if a blob with compressionName (which can be Uncompressed or UnknownCompression) is acceptable for a CandidateLocations* call with v2Options.
v2Options can be set to nil if the call is CandidateLocations (i.e. compression is not required to be known); if not nil, the call is assumed to be CandidateLocations2.
The (compressionOp, compressionAlgo) values are suitable for BICReplacementCandidate2
func DestructivelyPrioritizeReplacementCandidates ¶
func DestructivelyPrioritizeReplacementCandidates(cs []CandidateWithTime, primaryDigest, uncompressedDigest digest.Digest) []blobinfocache.BICReplacementCandidate2
DestructivelyPrioritizeReplacementCandidates consumes AND DESTROYS an array of possible replacement candidates with their last known existence times, the primary digest the user actually asked for, the corresponding uncompressed digest (if known, possibly equal to the primary digest) returns an appropriately prioritized and/or trimmed result suitable for a return value from types.BlobInfoCache.CandidateLocations.
WARNING: The array of candidates is destructively modified. (The implementation of this function could of course make a copy, but all CandidateLocations implementations build the slice of candidates only for the single purpose of calling this function anyway.)
Types ¶
type CandidateWithTime ¶
type CandidateWithTime struct { Candidate blobinfocache.BICReplacementCandidate2 // The replacement candidate LastSeen time.Time // Time the candidate was last known to exist (either read or written) (not set for Candidate.UnknownLocation) }
CandidateWithTime is the input to types.BICReplacementCandidate prioritization.