public interface SyncOptions
SyncClient.openDocument(com.twilio.sync.SyncOptions, com.twilio.sync.SyncDocumentObserver, com.twilio.sync.SuccessListener<com.twilio.sync.SyncDocument>)
SyncClient.openMap(com.twilio.sync.SyncOptions, com.twilio.sync.SyncMapObserver, com.twilio.sync.SuccessListener<com.twilio.sync.SyncMap>)
SyncClient.openList(com.twilio.sync.SyncOptions, com.twilio.sync.SyncListObserver, com.twilio.sync.SuccessListener<com.twilio.sync.SyncList>)
SyncClient.openStream(com.twilio.sync.SyncOptions, com.twilio.sync.SyncStreamObserver, com.twilio.sync.SuccessListener<com.twilio.sync.SyncStream>)
Typical usage pattern:
new SyncOptions().withUniqueName("myName")
| Modifier and Type | Interface and Description |
|---|---|
static class |
SyncOptions.OpenMode |
static class |
SyncOptions.SynchronizationStrategy |
| Modifier and Type | Field and Description |
|---|---|
static int |
INFINITE_DURATION
Time to live for a Sync object, specifying no expiry.
|
| Modifier and Type | Method and Description |
|---|---|
static SyncOptions |
create()
Public factory method to create a new instance of
SyncOptions. |
SyncOptions |
createWithUniqueName(java.lang.String uniqueName)
Creates a new object with specified unique name, fails if the given name is already in use.
|
SyncOptions.OpenMode |
getOpenMode() |
java.lang.String |
getSidOrUniqueName() |
SyncOptions.SynchronizationStrategy |
getSynchronizationStrategy() |
int |
getTtl() |
SyncOptions |
openWithSidOrUniqueName(java.lang.String sidOrUniqueName)
Opens an existing object with specified SID or unique name.
|
SyncOptions |
withStrategy(SyncOptions.SynchronizationStrategy strategy)
Set
SyncOptions.SynchronizationStrategy the Sync object. |
SyncOptions |
withTtl(int ttl)
Set time to live for the Sync object in seconds.
|
SyncOptions |
withUniqueName(java.lang.String uniqueName)
Creates a new object or opens an existing one with provided unique name.
|
SyncOptions |
withUniqueName(java.lang.String uniqueName,
SyncOptions.OpenMode mode)
Creates a new object or opens an existing one with provided unique name,
also given a specific opening mode.
|
static final int INFINITE_DURATION
static SyncOptions create()
SyncOptions.SyncOptions object.SyncOptions createWithUniqueName(java.lang.String uniqueName)
withUniqueName(String, OpenMode) with SyncOptions.OpenMode.CREATE_NEW mode.uniqueName - Unique name to assign to entity upon creation.SyncOptions withUniqueName(java.lang.String uniqueName)
withUniqueName(String, OpenMode) with SyncOptions.OpenMode.OPEN_OR_CREATE mode.uniqueName - Unique name to find existing entity
or to assign to new entity upon creation.SyncOptions withUniqueName(java.lang.String uniqueName, SyncOptions.OpenMode mode)
uniqueName - Unique name to find existing entity
or to assign to new entity upon creation.mode - Open mode, one of the constants SyncOptions.OpenMode.SyncOptions openWithSidOrUniqueName(java.lang.String sidOrUniqueName)
withUniqueName(String, OpenMode) with SyncOptions.OpenMode.OPEN_EXISTING mode.sidOrUniqueName - SID or unique name to find existing entity
or to assign to new entity upon creation.SyncOptions withStrategy(SyncOptions.SynchronizationStrategy strategy)
SyncOptions.SynchronizationStrategy the Sync object.strategy - SyncOptions.SynchronizationStrategy to assign to new entity.SyncOptions withTtl(int ttl)
This TTL specifies the minimum time the object will live, sometime soon after this time the object will be deleted.
If time to live is not specified, object lives infinitely long.
TTL could be used in order to auto-recycle old unused objects, but it is not recommended to build some app logic like timers using ttl.
This setting works with all object types, however note that it is applicable only when creating an object. When (re)opening an existing object, new TTL is not applied, and instead an old setting is retained, in order to avoid unexpected read-only object change.
ttl - Time to live in seconds from now or INFINITE_DURATION to indicate no expiry.java.lang.String getSidOrUniqueName()
SyncOptions.OpenMode getOpenMode()
SyncOptions.OpenMode.SyncOptions.SynchronizationStrategy getSynchronizationStrategy()
SyncOptions.SynchronizationStrategy.int getTtl()
INFINITE_DURATION to indicate no expiry.