mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 744282 - Switch untracking to use GUIDs only, with Record input as a convenience. r=nalexander
This commit is contained in:
parent
86d94910f9
commit
38105ffd3e
@ -5,6 +5,7 @@
|
||||
package org.mozilla.gecko.sync.repositories;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -359,7 +360,7 @@ public abstract class RepositorySession {
|
||||
// applied without changes.
|
||||
// This logic will become more complicated as reconciling becomes smarter.
|
||||
if (!localIsMoreRecent) {
|
||||
trackRecord(out);
|
||||
trackGUID(out.guid);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@ -370,12 +371,15 @@ public abstract class RepositorySession {
|
||||
* applied unmodified — should be tracked so as to not be uploaded
|
||||
* redundantly.
|
||||
*
|
||||
* The default implementation does nothing.
|
||||
* The default implementations do nothing.
|
||||
*/
|
||||
protected synchronized void trackRecord(Record record) {
|
||||
protected void trackGUID(String guid) {
|
||||
}
|
||||
|
||||
protected synchronized void untrackRecord(Record record) {
|
||||
protected synchronized void untrackGUIDs(Collection<String> guids) {
|
||||
}
|
||||
|
||||
protected void untrackGUID(String guid) {
|
||||
}
|
||||
|
||||
// Ah, Java. You wretched creature.
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
package org.mozilla.gecko.sync.repositories;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.mozilla.gecko.sync.Logger;
|
||||
@ -38,25 +39,45 @@ public abstract class StoreTrackingRepositorySession extends RepositorySession {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void trackRecord(Record record) {
|
||||
protected synchronized void trackGUID(String guid) {
|
||||
if (this.storeTracker == null) {
|
||||
throw new IllegalStateException("Store tracker not yet initialized!");
|
||||
}
|
||||
this.storeTracker.trackRecordForExclusion(guid);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void untrackGUID(String guid) {
|
||||
if (this.storeTracker == null) {
|
||||
throw new IllegalStateException("Store tracker not yet initialized!");
|
||||
}
|
||||
this.storeTracker.untrackStoredForExclusion(guid);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void untrackGUIDs(Collection<String> guids) {
|
||||
if (this.storeTracker == null) {
|
||||
throw new IllegalStateException("Store tracker not yet initialized!");
|
||||
}
|
||||
if (guids == null) {
|
||||
return;
|
||||
}
|
||||
for (String guid : guids) {
|
||||
this.storeTracker.untrackStoredForExclusion(guid);
|
||||
}
|
||||
}
|
||||
|
||||
protected void trackRecord(Record record) {
|
||||
|
||||
Logger.debug(LOG_TAG, "Tracking record " + record.guid +
|
||||
" (" + record.lastModified + ") to avoid re-upload.");
|
||||
// Future: we care about the timestamp…
|
||||
this.storeTracker.trackRecordForExclusion(record.guid);
|
||||
trackGUID(record.guid);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void untrackRecord(Record record) {
|
||||
if (this.storeTracker == null) {
|
||||
throw new IllegalStateException("Store tracker not yet initialized!");
|
||||
}
|
||||
|
||||
protected void untrackRecord(Record record) {
|
||||
Logger.debug(LOG_TAG, "Un-tracking record " + record.guid + ".");
|
||||
this.storeTracker.untrackStoredForExclusion(record.guid);
|
||||
untrackGUID(record.guid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user