1 #ifndef AKTUALIZR_UPTANE_ITERATOR_H_
2 #define AKTUALIZR_UPTANE_ITERATOR_H_
5 #include "imagerepository.h"
9 Targets getTrustedDelegation(
const Role &delegate_role,
const Targets &parent_targets,
10 const ImageRepository &image_repo,
INvStorage &storage, Fetcher &fetcher,
bool offline);
15 Role role{Role::Targets()};
17 std::vector<std::shared_ptr<DelegatedTargetTreeNode>>::size_type parent_idx{0};
18 std::vector<std::shared_ptr<DelegatedTargetTreeNode>> children;
22 using iterator_category = std::input_iterator_tag;
24 using difference_type = int;
30 std::shared_ptr<Uptane::Fetcher> fetcher,
bool is_end =
false);
37 std::shared_ptr<DelegatedTargetTreeNode> tree_;
40 std::shared_ptr<INvStorage> storage_;
41 std::shared_ptr<Fetcher> fetcher_;
42 std::shared_ptr<const Targets> cur_targets_;
43 std::vector<Targets>::size_type target_idx_{0};
44 std::vector<std::shared_ptr<DelegatedTargetTreeNode>>::size_type children_idx_{0};
45 bool terminating_{
false};
49 void renewTargetsData();
53 std::shared_ptr<Fetcher> fetcher)
54 : repo_{repo}, storage_{std::move(storage)}, fetcher_{std::move(fetcher)} {}
55 DelegationIterator begin() {
return DelegationIterator(repo_, storage_, fetcher_); }
56 DelegationIterator end() {
return DelegationIterator(repo_, storage_, fetcher_,
true); }
59 const ImageRepository &repo_;
60 std::shared_ptr<INvStorage> storage_;
61 std::shared_ptr<Uptane::Fetcher> fetcher_;
65 #endif // AKTUALIZR_UPTANE_ITERATOR_H_