Ejemplo n.º 1
0
    def lookup_cached_active_repository_tags(self, model_cache, repository_ref,
                                             start_pagination_id, limit):
        """
        Returns a page of active tags in a repository.

        Note that the tags returned by this method are ShallowTag objects, which only contain the
        tag name. This method will automatically cache the result and check the cache before making
        a call.
        """
        def load_tags():
            tags = self.lookup_active_repository_tags(repository_ref,
                                                      start_pagination_id,
                                                      limit)
            return [tag.asdict() for tag in tags]

        tags_cache_key = cache_key.for_active_repo_tags(
            repository_ref._db_id, start_pagination_id, limit)
        result = model_cache.retrieve(tags_cache_key, load_tags)

        try:
            return [ShallowTag.from_dict(tag_dict) for tag_dict in result]
        except FromDictionaryException:
            return self.lookup_active_repository_tags(repository_ref,
                                                      start_pagination_id,
                                                      limit)
Ejemplo n.º 2
0
 def lookup_active_repository_tags(self, repository_ref, start_pagination_id, limit):
     """
 Returns a page of actvie tags in a repository. Note that the tags returned by this method
 are ShallowTag objects, which only contain the tag name.
 """
     tags = oci.tag.lookup_alive_tags_shallow(repository_ref._db_id, start_pagination_id, limit)
     return [ShallowTag.for_tag(tag) for tag in tags]
Ejemplo n.º 3
0
    def delete_tags_for_manifest(self, manifest):
        """
        Deletes all tags pointing to the given manifest, making the manifest inaccessible for
        pulling.

        Returns the tags (ShallowTag) deleted. Returns None on error.
        """
        with db_disallow_replica_use():
            deleted_tags = oci.tag.delete_tags_for_manifest(manifest._db_id)
            return [ShallowTag.for_tag(tag) for tag in deleted_tags]
Ejemplo n.º 4
0
 def lookup_active_repository_tags(self, repository_ref,
                                   start_pagination_id, limit):
     """
 Returns a page of actvie tags in a repository. Note that the tags returned by this method
 are ShallowTag objects, which only contain the tag name.
 """
     tags = model.tag.list_active_repo_tags(repository_ref._db_id,
                                            include_images=False,
                                            start_id=start_pagination_id,
                                            limit=limit)
     return [ShallowTag.for_repository_tag(tag) for tag in tags]