MCPcopy Create free account
hub / github.com/Snapchat/Valdi / updateAsset

Method updateAsset

valdi/src/valdi/runtime/Resources/AssetsManager.cpp:251–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249 int32_t /*preferredHeight*/) {
250 // TODO(simon): Implement in a later PR
251}
252
253void AssetsManager::updateAsset(AssetsManagerTransaction& transaction, const AssetKey& assetKey) {
254 auto managedAsset = getManagedAsset(assetKey);
255 if (managedAsset == nullptr) {
256 return;
257 }
258
259 auto state = managedAsset->getState();
260 if constexpr (kEnableAssetsLogs) {
261 VALDI_INFO(_logger, "Updating asset '{}' with state {}", assetKey, state);
262 }
263
264 if (!removeManagedAssetIfNeeded(assetKey, managedAsset)) {
265 switch (state) {
266 case AssetStateInitial: {
267 if (managedAsset->hasConsumers()) {
268 resolveAssetLocation(transaction, assetKey, managedAsset);
269 }
270 } break;
271 case AssetStateResolvingLocation:
272 break;
273 case AssetStateFailedPermanently:
274 case AssetStateFailedRetryable:
275 case AssetStateReady:
276 updateAssetConsumers(transaction, assetKey, managedAsset);
277 break;
278 }
279 }
280
281 if (_listener != nullptr) {
282 _listener->onManagedAssetUpdated(managedAsset);
283 }
284}
285

Callers

nothing calls this directly

Calls 3

hasConsumersMethod · 0.80
onManagedAssetUpdatedMethod · 0.80
getStateMethod · 0.65

Tested by

no test coverage detected