Skip to content

Instantly share code, notes, and snippets.

@secondsun
Created December 10, 2013 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secondsun/df6724e89d7ae06cbb64 to your computer and use it in GitHub Desktop.
Save secondsun/df6724e89d7ae06cbb64 to your computer and use it in GitHub Desktop.
public interface SynchronizeEventListener<T> {
/**
* This is called whenever the underlying Synchronizer has new data.
*
* @param newData
*/
void dataUpdated(T newData);
/**
*
* This is called when there is a data conflict.
*
* The system will save the returned data.
*
* @param clientData
* @param serverData
* @return
*/
T resolveConflicts(T clientData, T serverData);
}
public interface Synchronizer<T> {
/**
* A listener listens for data on this synchronizer.
*
* @param listener
*/
public void addListener(SynchronizeEventListener<T> listener);
/**
* A listener listens for data on this synchronizer.
*
* @param listener
*/
public void removeListener(SynchronizeEventListener<T> listener);
/**
* Does what ever is necessary to start syncing
*/
public void beginSync(Context appContext);
/**
* Sync no more
*/
public void syncNoMore();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment