io.realm.mongodb.sync
Enclosing class:
Builder used to construct instances of a SyncConfiguration in a fluent manner.
Constructores
Constructor and Description |
|---|
Resumen del método
Modificador y Tipo | Método y descripción |
|---|---|
public SyncConfiguration.Builder | |
public SyncConfiguration.Builder | Establece si o no |
public SyncConfiguration.Builder | Sets whether or not calls to Realm.executeTransaction are allowed from the UI thread. |
public SyncConfiguration.Builder | |
público SyncConfiguration | build () Crea la RealmConfiguration basada en los parámetros del generador. |
public SyncConfiguration.Builder | Sets the handler for when a Client Reset occurs. |
public SyncConfiguration.Builder | Sets this to determine if the Realm file should be compacted before returned to the user. |
public SyncConfiguration.Builder | Si estableces esta opción, Realm compactará el archivo Realm si este ha crecido demasiado y se puede recuperar una cantidad significativa de espacio. |
public SyncConfiguration.Builder | Establece la clave de bytes io.realm.Realm#ENCRYPTION_KEY_LENGTH utilizada para cifrar y descifrar el archivo Realm. |
public SyncConfiguration.Builder | Sets the error handler used by this configuration. |
public SyncConfiguration.Builder | Establece la FlowFactory utilizada para crear flujos de corrutinas a partir de objetos Realm. |
public SyncConfiguration.Builder | inMemory () Establecer esto creará un Realm en memoria en lugar de guardarlo en el disco. |
public SyncConfiguration.Builder | Sets the initial data in io.realm.Realm . |
public SyncConfiguration.Builder | Establece las suscripciones iniciales para io.realm.Realm. |
public SyncConfiguration.Builder | Establece el número máximo de versiones activas en el archivo Realm antes de que se lance una IllegalStateException al intentar guardar más datos. |
public SyncConfiguration.Builder | Replaces the existing module(s) with one or more RealmModule s. |
public SyncConfiguration.Builder | Replaces the existing module(s) with one or more RealmModule s. |
public SyncConfiguration.Builder | |
public SyncConfiguration.Builder | readOnly () Configurar esto hará que el Realm se vuelva de solo lectura y todas las transacciones de escritura realizadas contra este Realm fallarán con una IllegalStateException . |
public SyncConfiguration.Builder | Sets the RxObservableFactory used to create Rx Observables from Realm objects. |
public SyncConfiguration.Builder | Establece la versión de esquema del Realm. |
public SyncConfiguration.Builder | Sets the handler for when a Client Reset occurs. |
public SyncConfiguration.Builder | Sets the handler for when a Client Reset occurs. |
public SyncConfiguration.Builder | |
public SyncConfiguration.Builder | Al configurar esto, el Realm descargará todos los cambios conocidos desde el servidor la primera vez que se abra un Realm. |
public SyncConfiguration.Builder | Al configurar esto, el Realm descargará todos los cambios conocidos desde el servidor la primera vez que se abra un Realm. |
Inherited Methods
Methods inherited from class java.lang.Object :
getClass,hashCode,equals,clone,toString,notify,notifyAll,wait,wait,wait,finalize
Constructor Detail
Crea una instancia del generador para una SyncConfiguration de Flexible Sync con el usuario dado. Parámetros
Tip
|
Crea una instancia del generador para una sincronización basada en partición SyncConfiguration con el usuario y el valor de partición indicados. Parámetros
|
Crea una instancia del generador para una sincronización basada en partición SyncConfiguration con el usuario y el valor de partición indicados. Parámetros
|
Detalle del método
addModule
Agrega un módulo a los módulos ya definidos. |
allowQueriesOnUiThread
Sets whether or not By default Realm allows queries on the main thread. However, by doing so your application may experience a drop of frames or even ANRs. We recommend diverting queries to non-UI threads or, alternatively, using RealmQuery.findAllAsync() or RealmQuery.findFirstAsync() . |
allowWritesOnUiThread
Sets whether or not calls to Realm.executeTransaction are allowed from the UI thread. WARNING: Realm does not allow synchronous transactions to be run on the main thread unless users explicitly opt in with this method. We recommend diverting calls to |
assetFile
Al abrir un Realm por primera vez, en lugar de crear un archivo vacío, el archivo Realm se copiará del archivo de recursos proporcionado y se usará en su lugar. Esto puede usarse para pre-poblar el Realm con datos, para que no sea necesario descargarlos del servidor. El archivo Realm proporcionado debe ser un Realm sincronizado válido para el usuario dado y debe haber sido creado utilizando la API Realm.writeCopyTo(File). ADVERTENCIA: Esto podría ser una operación prolongada y, lo ideal, es realizarla en un hilo en segundo plano. Parámetros
Throws
|
compilar
public SyncConfiguration build () |
|---|
Crea la RealmConfiguration basada en los parámetros del generador. Devuelve el SyncConfiguration creado. Throws
|
clientResetHandler
Sets the handler for when a Client Reset occurs. If no handler is set, and error is logged when a Client Reset occurs. Parámetros
|
compactOnLaunch
Sets this to determine if the Realm file should be compacted before returned to the user. It is passed the total file size (data + free space) and the bytes used by data in the file. Parámetros
|
public SyncConfiguration.Builder compactOnLaunch () |
|---|
Setting this will cause Realm to compact the Realm file if the Realm file has grown too large and a significant amount of space can be recovered. See DefaultCompactOnLaunchCallback for details. |
encryptionKey
Establece la clave de bytes io.realm.Realm#ENCRYPTION_KEY_LENGTH utilizada para cifrar y descifrar el archivo Realm. Parámetros
Throws
|
errorHandler
Establece el gestor de errores utilizado por esta configuración. Solo los errores que no sean manejados por el Parámetros
Throws
|
flowFactory
Sets the FlowFactory used to create coroutines Flows from Realm objects. The default factory is RealmFlowFactory . Parámetros
|
En memoria
public SyncConfiguration.Builder inMemory () |
|---|
Setting this will create an in-memory Realm instead of saving it to disk. In-memory Realms might still use disk space if memory is running low, but all files created by an in-memory Realm will be deleted when the Realm is closed.Note that because in-memory Realms are not persisted, you must be sure to hold on to at least one non-closed reference to the in-memory Realm object with the specific name as long as you want the data to last. |
initialData
Establece los datos iniciales en io.realm.Realm. Esta transacción se ejecutará solo la primera vez que se abra (cree) el archivo Realm o durante la migración de datos si se ha definido RealmConfiguration.Builder.deleteRealmIfMigrationNeeded(). Parámetros
|
initialSubscriptions
Sets the initial Subscription s for the io.realm.Realm . This will only be executed the first time the Realm file is opened (and the file created). If waitForInitialRemoteData() is configured as well, the realm file isn't fully opened until all subscription data also has been uploaded. Parámetros
|
maxNumberOfActiveVersions
Establece el número máximo de versiones activas en el archivo Realm antes de que se lance una IllegalStateException al intentar guardar más datos. Realm is capable of concurrently handling many different versions of Realm objects. This can happen if you have a Realm open on many different threads or are freezing objects while data is being written to the file. Under normal circumstances this is not a problem, but if the number of active versions grow too large, it will have a negative effect on the filesize on disk. Setting this parameters can therefore be used to prevent uses of Realm that can result in very large Realms. Note, the version number will also increase when changes from other devices are integrated on this device, so the number of active versions will also depend on what other devices writing to the same Realm are doing. Parámetros
Tip |
modules
Replaces the existing module(s) with one or more RealmModule s. Using this method will replace the current schema for this Realm with the schema defined by the provided modules. A reference to the default Realm module containing all Realm classes in the project (but not dependencies), can be found using Realm.getDefaultModule() . Combining the schema from the app project and a library dependency is thus done using the following code:
Parámetros
Throws
|
Replaces the existing module(s) with one or more RealmModule s. Using this method will replace the current schema for this Realm with the schema defined by the provided modules. A reference to the default Realm module containing all Realm classes in the project (but not dependencies), can be found using Realm.getDefaultModule() . Combining the schema from the app project and a library dependency is thus done using the following code:
Parámetros
Throws
|
Nombre
Sets the filename for the Realm file on this device. Parámetros
|
Solo lectura
public SyncConfiguration.Builder readOnly () |
|---|
Configurar esto hará que el Realm se vuelva de solo lectura y todas las transacciones de escritura realizadas contra este Realm fallarán con una IllegalStateException . This in particular mean that initialData(Realm.Transaction) will not work in combination with a read only Realm and setting this will result in a IllegalStateException being thrown. Marking a Realm as read only only applies to the Realm in this process. Other processes and devices can still write to the Realm. |
rxFactory
Establece la RxObservableFactory que se usa para crear Rx Observables a partir de objetos Realm. La fábrica por defecto es RealmObservableFactory . Parámetros
|
schemaVersion
Establece la versión del esquema de Realm. Solo los Realms sincronizados admiten cambios aditivos en el esquema que pueden aplicarse sin requerir una migración manual. La versión del esquema solo se utilizará como una indicación para la capa de almacenamiento subyacente para remover o agregar índices. Estos serán recalculados si la versión del esquema proporcionada difiere de la versión en el archivo Realm. ADVERTENCIA: No se garantiza que el valor insertado aquí sea el mismo que retorna Realm.getVersion(). Debido a la naturaleza de los Realms sincronizados, el valor tanto puede ser superior como inferior.
Parámetros
Throws
|
syncClientResetStrategy
Sets the handler for when a Client Reset occurs. If no handler is set, and error is logged when a Client Reset occurs. This strategy is only available for synced realms using partition based sync. Realms using flexible sync currently only support syncClientResetStrategy(ManuallyRecoverUnsyncedChangesStrategy) . Parámetros
|
Sets the handler for when a Client Reset occurs. If no handler is set, and error is logged when a Client Reset occurs. Parámetros
|
urlPrefix
The prefix that is prepended to the path in the WebSocket request that initiates a sync connection to MongoDB Realm. The value specified must match the server’s configuration otherwise the device will not be able to create a connection. This value is optional and should only be set if a specific firewall rule requires it. Parámetros
|
waitForInitialRemoteData
Al configurar esto, Realm descargará todos los cambios conocidos del servidor la primera vez que se abra. Realm no se abrirá hasta que se hayan descargado todos los datos. Esto significa que, si un dispositivo está sin conexión, Realm no se abrirá. Dado que descargar todos los cambios puede ser una operación larga que podría bloquear el hilo de la interfaz de usuario, los Realms con esta configuración habilitada solo deben abrirse en hilos en segundo plano o con Realm.getInstanceAsync(RealmConfiguration, Realm.Callback) en el hilo de la interfaz de usuario. This check is only enforced the first time a Realm is created. If you otherwise want to make sure a Realm has the latest changes, use SyncSession.downloadAllServerChanges() . Parámetros
|
Al configurar esto, Realm descargará todos los cambios conocidos del servidor la primera vez que se abra. Realm no se abrirá hasta que se hayan descargado todos los datos. Esto significa que, si un dispositivo está sin conexión, Realm no se abrirá. Dado que descargar todos los cambios puede ser una operación larga que podría bloquear el hilo de la interfaz de usuario, los Realms con esta configuración habilitada solo deben abrirse en hilos en segundo plano o con Realm.getInstanceAsync(RealmConfiguration, Realm.Callback) en el hilo de la interfaz de usuario. This check is only enforced the first time a Realm is created. If you otherwise want to make sure a Realm has the latest changes, use SyncSession.downloadAllServerChanges() . |