Make the MongoDB docs better! We value your opinion. Share your feedback for a chance to win $100.
Click here >
Docs Menu
Docs Home
/ /
io.realm

Interface CompactOnLaunchCallback

This interface is used to determine if a Realm file should be compacted the first time the file is opened and before the instance is returned.Note that compacting a file can take a while, so compacting should generally only be done on a background thread or when used in combination with 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