Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /
io.realm

Interfaz CompactOnLaunchCallback

Esta interfaz se utiliza para determinar si un archivo Realm debe compactarse la primera vez que se abre el archivo y antes de que se devuelva la instancia. Tenga en cuenta que compactar un archivo puede llevar un tiempo, por lo que generalmente solo debe realizarse en un hilo en segundo plano o cuando se usa en combinación con Realm.getInstanceAsync(RealmConfiguration, io.realm.Realm.Callback).

Modificador y Tipo
Método y descripción

public booleano

long totalBytes,
long usedBytes
)

This method determines if the Realm file should be compacted before opened and returned to the user.

public boolean shouldCompact (
long totalBytes,
long usedBytes
)

Este método determina si el archivo Realm se debe compactar antes de abrirlo y devolverlo al usuario. Se le pasa el tamaño total del archivo (datos + espacio libre) y los bytes utilizados por los datos en el archivo.

Parámetros

  • totalBytes - the total file size (data + free space).

  • usedBytes - the total bytes used by data in the file.

Devuelve

{code true} to indicate an attempt to compact the file should be made. Otherwise, the compaction will be skipped.

Volver

CollectionUtils

En esta página