RSPImageTagCollection#

class nublado.controller.models.domain.rsptag.RSPImageTagCollection(tags)#

Bases: Generic

Hold and perform operations on a set of RSPImageTag objects.

Parameters:

tags (Iterable[TypeVar(T, bound= RSPImageTag)]) – RSPImageTag objects to store.

Methods Summary

add(tag)

Add a tag to the collection.

all_tags(*[, hide_arch_specific])

Iterate over all tags.

filter(policy, age_basis, *[, ...])

Apply a filter policy and return the remaining tags.

from_tag_names(tag_names, aliases[, cycle])

Create a collection from tag strings.

latest(image_type)

Get the latest tag of a given type.

subset(*[, releases, weeklies, dailies, ...])

Return a subset of the tag collection.

tag_for_tag_name(tag_name)

Look up a tag by tag name.

Methods Documentation

add(tag)#

Add a tag to the collection.

Parameters:

tag (TypeVar(T, bound= RSPImageTag)) – The tag to add.

Return type:

None

all_tags(*, hide_arch_specific=True)#

Iterate over all tags.

Parameters:

hide_arch_specific (bool, default: True) – If True, hide tags for a specific architecture and only include tags for all supported architectures.

Yields:

RSPImageTag – Each tag in sorted order.

Return type:

Iterator[TypeVar(T, bound= RSPImageTag)]

filter(policy, age_basis, *, remove_arch_specific=True)#

Apply a filter policy and return the remaining tags.

Parameters:
  • policy (RSPImageFilterPolicy) – Policy governing tag filtering.

  • age_basis (datetime) – Timestamp to use as basis for image age calculation.

  • remove_arch_specific (bool, default: True) – If True, remove tags for a specific architecture and only include tags for all supported architectures.

Yields:

RSPImageTag – Next tag allowed under the policy.

Return type:

Iterator[TypeVar(T, bound= RSPImageTag)]

classmethod from_tag_names(tag_names, aliases, cycle=None)#

Create a collection from tag strings.

Parameters:
  • tag_names (Iterable[str]) – Tag strings that should be parsed as tags.

  • aliases (set[str]) – Tags by these names, if found, should be treated as aliases.

  • cycle (Optional[int], default: None) – If given, only add tags with a matching cycle.

Returns:

The resulting collection of tags.

Return type:

RSPImageTagCollection

latest(image_type)#

Get the latest tag of a given type.

Parameters:

image_type (RSPImageType) – Image type to retrieve.

Returns:

Latest tag of that type, if any.

Return type:

RSPImageTag or None

subset(*, releases=0, weeklies=0, dailies=0, include=None, remove_arch_specific=True)#

Return a subset of the tag collection.

Parameters:
  • releases (int, default: 0) – Number of releases to include.

  • weeklies (int, default: 0) – Number of weeklies to include.

  • dailies (int, default: 0) – Number of dailies to include.

  • include (Optional[set[str]], default: None) – Include this list of tags even if they don’t meet other criteria.

  • remove_arch_specific (bool, default: True) – If True, remove tags for a specific architecture and only include tags for all supported architectures.

Returns:

The desired subset.

Return type:

RSPImageTagCollection

tag_for_tag_name(tag_name)#

Look up a tag by tag name.

Parameters:

tag_name (str) – Tag to search for.

Returns:

The tag if found in the collection, else None.

Return type:

bool