зеркало из https://github.com/mozilla/pjs.git
Bug 718238 - Part 5: allow access to the tracked GUIDs in RepositorySession. r=nalexander
This commit is contained in:
Родитель
ac2465bdd6
Коммит
0f2424b0c6
|
@ -5,6 +5,7 @@
|
|||
package org.mozilla.gecko.sync.repositories;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.mozilla.gecko.sync.repositories.domain.Record;
|
||||
|
||||
|
@ -52,4 +53,9 @@ public class HashSetStoreTracker implements StoreTracker {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<String> recordsTrackedForExclusion() {
|
||||
return this.guids.iterator();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
|
||||
package org.mozilla.gecko.sync.repositories;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
@ -355,4 +357,9 @@ public abstract class RepositorySession {
|
|||
|
||||
protected synchronized void untrackRecord(Record record) {
|
||||
}
|
||||
|
||||
// Ah, Java. You wretched creature.
|
||||
public Iterator<String> getTrackedRecordIDs() {
|
||||
return new ArrayList<String>().iterator();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
package org.mozilla.gecko.sync.repositories;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Our hacky version of transactional semantics. The goal is to prevent
|
||||
* the following situation:
|
||||
|
@ -75,4 +77,6 @@ public interface StoreTracker {
|
|||
public boolean untrackStoredForExclusion(String guid);
|
||||
|
||||
public RecordFilter getFilter();
|
||||
|
||||
public Iterator<String> recordsTrackedForExclusion();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
package org.mozilla.gecko.sync.repositories;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.mozilla.gecko.sync.Logger;
|
||||
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionBeginDelegate;
|
||||
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionFinishDelegate;
|
||||
|
@ -57,6 +59,14 @@ public abstract class StoreTrackingRepositorySession extends RepositorySession {
|
|||
this.storeTracker.untrackStoredForExclusion(record.guid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<String> getTrackedRecordIDs() {
|
||||
if (this.storeTracker == null) {
|
||||
throw new IllegalStateException("Store tracker not yet initialized!");
|
||||
}
|
||||
return this.storeTracker.recordsTrackedForExclusion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void abort(RepositorySessionFinishDelegate delegate) {
|
||||
this.storeTracker = null;
|
||||
|
|
Загрузка…
Ссылка в новой задаче