io.realm.mongodb.sync
Implemented interfaces:
A subscription set is an immutable view of all current Subscription s for a given Realm that has been configured for flexible sync.
Flexible Sync is a way of defining which data gets synchronized to and from the device using RealmQuery s. The query and its metadata are represented by a Subscription .
Un conjunto de suscripciones define todos los datos disponibles para el dispositivo y que se sincronizan con el servidor. Si el conjunto de suscripciones detecta un error, por ejemplo, al contener una consulta no válida, todo el conjunto entrará en el estado SubscriptionSet.State.ERROR y no se realizará ninguna sincronización hasta que se corrija el error.
If a subscription is removed, so is the corresponding data, but it is only removed from the device. It isn't deleted on the server.
Es posible modificar un conjunto de suscripciones sin conexión, pero el servidor no acepta la modificación antes de que getState() devuelva SubscriptionSet.State.COMPLETE.
It is possible to force the subscription set to be synchronized with the server by using waitForSynchronization() and its variants.
Nested Class Summary
Modificador y Tipo | Clase y descripción |
|---|---|
| |
| |
| |
|
Resumen del método
Modificador y Tipo | Método y descripción |
|---|---|
public Subscription | |
public Subscription | Encuentre la primera suscripción que contenga la consulta dada. |
public String | If getState() returns State.ERROR , this method will return the reason. |
public SubscriptionSet.State | getState () Returns the current state of the SubscriptionSet. |
public int | size () Returns how many subscriptions are currently in this subscription set. |
Modify the subscription set. | |
public RealmAsyncTask | Modifica de manera asíncrona el conjunto de suscripciones. |
public booleano | Wait for the subscription set to synchronize with the server. |
public booleano | Wait for the subscription set to synchronize with the server. |
public RealmAsyncTask | ) Asynchronously wait for the subscription set to synchronize with the server. |
public RealmAsyncTask | Asynchronously wait for the subscription set to synchronize with the server. |
Inherited Methods
Detalle del método
buscar
Encuentra la suscripción con un nombre determinado. Parámetros
Devuelve the matching subscription or |
Find the first subscription that contains the given query. It is possible for multiple named subscriptions to contain the same query. Parámetros
Devuelve the first subscription containing the query or |
getErrorMessage
public String getErrorMessage () |
|---|
If getState() returns State.ERROR , this method will return the reason. Errors can be fixed by modifying the subscription accordingly and then calling waitForSynchronization() . Devuelve the underlying error if the subscription set is in the State.ERROR state. For all other states |
getState
public SubscriptionSet.State getState () |
|---|
Devuelve el estado actual del SubscriptionSet. Consulte SubscriptionSet.State para obtener más detalles sobre cada estado. Devuelve estado actual del SubscriptionSet. |
tamaño
public int size () |
|---|
Returns how many subscriptions are currently in this subscription set. Devuelve the number of of subscriptions in the subscription set. |
update
Modify the subscription set. If an exception is thrown during the update, no changes will be applied. If the update succeeds, this subscription set is updated with the modified state. Parámetros
Devuelve este conjunto de suscripción, que ahora ha sido actualizado. Throws
|
updateAsync
Modificar asincrónicamente el conjunto de suscripciones. Si se genera una excepción durante la actualización, no se aplicarán los cambios. * Parámetros
Devuelve Tarea que controla la ejecución asincrónica. |
waitForSynchronization
Espera a que el conjunto de suscripción se sincronice con el servidor. Devuelve cuando el servidor acepta el conjunto de queries y ha descargado datos para ellas, o si se ha producido un error. Ten en cuenta que necesitarás llamar manualmente a Realm.refresh() o esperar a que los oyentes de cambios se activen para ver los datos descargados. Si ocurre un error, la razón subyacente se puede encontrar a través de getErrorMessage() . Parámetros
Devuelve
Throws
|
public boolean waitForSynchronization () |
|---|
Espera a que el conjunto de suscripción se sincronice con el servidor. Devuelve cuando el servidor acepta el conjunto de queries y ha descargado datos para ellas, o si se ha producido un error. Ten en cuenta que necesitarás llamar manualmente a Realm.refresh() o esperar a que los oyentes de cambios se activen para ver los datos descargados. Si ocurre un error, la razón subyacente se puede encontrar a través de getErrorMessage() . Devuelve
|
esperarSincronizaciónAsync
) |
|---|
Asynchronously wait for the subscription set to synchronize with the server. The callback is invoked when the server either accepts the set of queries and has downloaded data for them, or if an error has occurred. Note, that you will either need to manually call Realm.refresh() or wait for change listeners to trigger to see the downloaded data. If an error occurred, the underlying reason can be found through getErrorMessage() . Parámetros
Devuelve
|
Espera de manera asíncrona a que el conjunto de suscripción se sincronice con el servidor. Invocará la función de retorno cuando el servidor acepte el conjunto de queries y haya descargado datos para ellas, o si se produce algún error. Ten en cuenta que necesitarás llamar manualmente a Realm.refresh() o esperar a que los oyentes de cambios se activen para ver los datos descargados. Si ocurre un error, la razón subyacente se puede encontrar a través de getErrorMessage() . Parámetros
Devuelve
|