public interface SyncTemplate
An interface for the DataGate sync operations.
Modifier and Type | Method and Description |
---|---|
boolean |
change(ChangeFeed changeFeed)
Uploads the local changes to the server.
|
ChangeFeed |
changedSince(FeedOptions feedOptions)
Downloads the list of changes from the server.
|
void |
clear()
Clears the remote collection.
|
java.util.List<Document> |
fetch(int offset,
int limit)
Fetches all documents from remote.
|
java.lang.String |
getCollectionName()
Gets the name of the remote collection.
|
boolean |
isOnline()
Checks if the server is online and reachable.
|
void |
releaseLock(java.lang.String issuer)
Releases the synchronization lock on the remote collection.
|
long |
size()
Gets the size of the remote collection.
|
boolean |
trySyncLock(TimeSpan expiryDelay,
java.lang.String issuer)
Tries to acquire a synchronization lock on the remote collection.
|
ChangeFeed changedSince(FeedOptions feedOptions)
Downloads the list of changes from the server.
feedOptions
- options to fetch the change feedboolean change(ChangeFeed changeFeed)
Uploads the local changes to the server.
changeFeed
- the list of changes to uploadtrue
if the operation is successful; false
otherwise.java.util.List<Document> fetch(int offset, int limit)
Fetches all documents from remote.
offset
- pagination offsetlimit
- pagination limitlong size()
Gets the size of the remote collection.
void clear()
Clears the remote collection.
boolean isOnline()
Checks if the server is online and reachable.
true
if online; false
otherwise.java.lang.String getCollectionName()
Gets the name of the remote collection.
boolean trySyncLock(TimeSpan expiryDelay, java.lang.String issuer)
Tries to acquire a synchronization lock on the remote collection. Before start of replication, a sync lock must be acquired on remote collection. If the acquisition is unsuccessful, replication will not occur and it will be retried in next iteration.
If the expiryDelay is expired, then a new lock will be acquired overwriting previous lock information.
Lock information should be maintain as a metadata in the remote database in a separate collection/table than the remote collection. |
expiryDelay
- the expiry delayissuer
- originator of the change feedvoid releaseLock(java.lang.String issuer)
Releases the synchronization lock on the remote collection.