2929
3030namespace vcpkg
3131{
32+ struct BinaryProviderContainer
33+ {
34+ std::vector<std::unique_ptr<IReadBinaryProvider>> read = {};
35+ std::unique_ptr<IWriteBinaryProvider> write = nullptr ;
36+ bool write_back = false ;
37+ };
38+
3239 struct CacheStatus
3340 {
3441 bool should_attempt_precheck (const IReadBinaryProvider* sender) const noexcept ;
3542 bool should_attempt_restore (const IReadBinaryProvider* sender) const noexcept ;
3643
3744 bool is_unavailable (const IReadBinaryProvider* sender) const noexcept ;
3845 const IReadBinaryProvider* get_available_provider () const noexcept ;
46+ const BinaryProviderContainer* get_restored_container () const noexcept ;
3947 bool is_restored () const noexcept ;
4048
4149 void mark_unavailable (const IReadBinaryProvider* sender);
4250 void mark_available (const IReadBinaryProvider* sender) noexcept ;
43- void mark_restored () noexcept ;
51+ void mark_restored (const BinaryProviderContainer* container ) noexcept ;
4452
4553 private:
4654 CacheStatusState m_status = CacheStatusState::unknown;
@@ -51,6 +59,9 @@ namespace vcpkg
5159
5260 // The provider who affirmatively has the associated cache entry.
5361 const IReadBinaryProvider* m_available_provider = nullptr ; // meaningful iff m_status == available
62+
63+ // The provider who restored the associated cache entry.
64+ const BinaryProviderContainer* m_restored_container = nullptr ; // meaningful iff m_status == restored
5465 };
5566
5667 struct BinaryPackageReadInfo
@@ -136,37 +147,43 @@ namespace vcpkg
136147 {
137148 std::vector<Path> archives_to_read;
138149 std::vector<Path> archives_to_write;
150+ bool write_back = false ;
139151 };
140152
141153 struct HttpBinaryProviderConfig
142154 {
143155 std::vector<std::string> secrets;
144156 std::vector<UrlTemplate> url_templates_to_get;
145157 std::vector<UrlTemplate> url_templates_to_put;
158+ bool write_back = false ;
146159 };
147160
148161 struct GcsBinaryProviderConfig
149162 {
150163 std::vector<std::string> gcs_read_prefixes;
151164 std::vector<std::string> gcs_write_prefixes;
165+ bool write_back = false ;
152166 };
153167
154168 struct AwsBinaryProviderConfig
155169 {
156170 std::vector<std::string> aws_read_prefixes;
157171 std::vector<std::string> aws_write_prefixes;
172+ bool write_back = false ;
158173 };
159174
160175 struct CosBinaryProviderConfig
161176 {
162177 std::vector<std::string> cos_read_prefixes;
163178 std::vector<std::string> cos_write_prefixes;
179+ bool write_back = false ;
164180 };
165181
166182 struct GhaBinaryProviderConfig
167183 {
168184 bool gha_write = false ;
169185 bool gha_read = false ;
186+ bool write_back = false ;
170187 };
171188
172189 struct NugetBinaryProviderConfig
@@ -176,12 +193,16 @@ namespace vcpkg
176193
177194 std::vector<Path> configs_to_read;
178195 std::vector<Path> configs_to_write;
196+
197+ bool write_back = false ;
179198 };
180199
181200 struct AzureUpkgBinaryProviderConfig
182201 {
183202 std::vector<AzureUpkgSource> upkg_templates_to_get;
184203 std::vector<AzureUpkgSource> upkg_templates_to_put;
204+
205+ bool write_back = false ;
185206 };
186207
187208 using BinaryProviderConfig = std::variant<FilesBinaryProviderConfig,
@@ -216,8 +237,7 @@ namespace vcpkg
216237
217238 struct BinaryProviders
218239 {
219- std::vector<std::unique_ptr<IReadBinaryProvider>> read;
220- std::vector<std::unique_ptr<IWriteBinaryProvider>> write;
240+ std::vector<std::unique_ptr<BinaryProviderContainer>> containers;
221241 std::string nuget_prefix;
222242 NuGetRepoInfo nuget_repo;
223243 };
@@ -310,6 +330,8 @@ namespace vcpkg
310330 {
311331 BinaryPackageWriteInfo request;
312332 CleanPackages clean_after_push;
333+ bool write_back = false ;
334+ const BinaryProviderContainer* restored_container = nullptr ;
313335 };
314336
315337 ZipTool m_zip_tool;
0 commit comments