@Override @Transactional(retryOn = ONeedRetryException.class) public void setCacheInfo(final String path, final CacheInfo cacheInfo) throws IOException { StorageTx tx = UnitOfWork.currentTransaction(); Component component = tx.findComponentWithProperty(P_PATH, path, tx.getBucket()); if (component == null) { log.debug("Attempting to set last verified date for non-existent raw component {}", path); } final Asset asset = tx.firstAsset(component); log.debug("Updating cacheInfo of {} to {}", path, cacheInfo); CacheInfo.applyToAsset(asset, cacheInfo); tx.saveAsset(tx.firstAsset(component)); }
// TODO: Consider a top-level indexed property (e.g. "locator") to make these common lookups fast private Component getComponent(StorageTx tx, String path, Bucket bucket) { String property = String.format("%s.%s.%s", P_ATTRIBUTES, RawFormat.NAME, P_PATH); return tx.findComponentWithProperty(property, path, bucket); }