In some scenarios, you may want to sync tables using different priorities. For example, you may want to sync a subset of all tables first to log a user in as fast as possible, then sync the remaining tables in the background.
priority
YAML key, or with the _priority
attribute inside parameter queries:
lists
bucket has the default priority of 1, meaning it syncs first.
The todos
bucket is assigned a priority of 2, meaning it may sync only after the lists have been synced.
waitForFirstSync(priority: int)
. When passing the optional priority
parameter to this method, it will wait for specific priority level to complete syncing.SyncStatus.priorityStatusEntries()
A list containing sync information for each priority that was seen by the PowerSync Service.SyncStatus.statusForPriority(priority: int)
This method takes a fixed priority and returns the sync state for that priority by looking it up in priorityStatusEntries
.