/** * Queue an async operation to purge all matching records under a base path. * <ol> * <li>Uses a depth first search</li> * <li>A match is on ID and persistence policy, or, if policy==-1, any match</li> * <li>If a record matches then it is deleted without any child searches</li> * <li>Deletions will be asynchronous if a callback is provided</li> * </ol> * @param path base path * @param id ID for service record.id * @param persistencePolicyMatch ID for the persistence policy to match: * no match, no delete. * @param purgePolicy how to react to children under the entry * @param callback an optional callback * @return a future that returns the #of records deleted */ @VisibleForTesting public Future<Integer> purgeRecordsAsync(String path, String id, String persistencePolicyMatch, PurgePolicy purgePolicy, BackgroundCallback callback) { LOG.info(" records under {} with ID {} and policy {}: {}", path, id, persistencePolicyMatch); return submit( new AsyncPurge(path, new SelectByYarnPersistence(id, persistencePolicyMatch), purgePolicy, callback)); }