int CollectorEngine::invalidateAds(AdTypes adType, ClassAd &query) { CollectorHashTable *table=0; CollectorEngine::HashFunc func; if (!LookupByAdType(adType, table, func)) { dprintf (D_ALWAYS, "Unknown type %d\n", adType); return 0; } int count = 0; ClassAd *ad; AdNameHashKey hk; MyString hkString; (*table).startIterations(); while ((*table).iterate (ad)) { if (IsAHalfMatch(&query, ad)) { (*table).getCurrentKey(hk); hk.sprint(hkString); if ((*table).remove(hk) == -1) { dprintf(D_ALWAYS, "\t\tError while removing ad: \"%s\"\n", hkString.Value()); } else { dprintf(D_ALWAYS, "\t\t**** Invalidating ad: \"%s\"\n", hkString.Value()); delete ad; count++; } } } return count; }
QueryResult CondorQuery:: filterAds (ClassAdList &in, ClassAdList &out) { ClassAd queryAd, *candidate; QueryResult result; // make the query ad result = getQueryAd (queryAd); if (result != Q_OK) return result; in.Open(); while( (candidate = (ClassAd *) in.Next()) ) { // if a match occurs if (IsAHalfMatch(&queryAd, candidate)) out.Insert (candidate); } in.Close (); return Q_OK; }