public final enum

InstantDocumentState

extends Enum<E extends Enum<E>>
java.lang.Object
   ↳ java.lang.Enum<E extends java.lang.Enum<E>>
     ↳ com.pspdfkit.instant.document.InstantDocumentState

Class Overview

Lists the observable states of an Instant document and its sync cycle.

The term “sync cycle” refers to the repetitive transitions between the states “receiving changes” and “sending changes” until there are no unsynced local changes remaining. If you are using automatic sync, a sync cycle will begin delayed after the last change to an annotation of the document. New sync cycle can also be triggered by changes coming in from the server when listening for server changes.

When not listening for server changes and with automatic sync of local changes disabled, a sync cycle starts whenever you call syncAnnotations().

Summary

Enum Values
InstantDocumentState  CLEAN  The document is valid and has no local changes. 
InstantDocumentState  DIRTY  The document is valid but has local changes that have not been synced to the server. 
InstantDocumentState  INVALID  The document is invalid and cannot be used any longer. 
InstantDocumentState  NEEDS_RESET_FOR_DATABASE_MIGRATION  The current database version does not include required metadata on at least some records. 
InstantDocumentState  RECEIVING_CHANGES  The document is busy syncing — currently receiving changes from the server. 
InstantDocumentState  RESETTING_FOR_DATABASE_MIGRATION  The layer's record store is being updated with the latest server version. 
InstantDocumentState  SENDING_CHANGES  The document is busy syncing — currently sending its local changes to the server. 
InstantDocumentState  UNKNOWN  Document is in an unknown state. 
Public Methods
static InstantDocumentState valueOf(String name)
final static InstantDocumentState[] values()
[Expand]
Inherited Methods
From class java.lang.Enum
From class java.lang.Object
From interface java.lang.Comparable

Enum Values

public static final InstantDocumentState CLEAN

The document is valid and has no local changes.

Note: If you are listening for server changes via setListenToServerChanges(boolean) this also implies that you have the latest observable changes from the server.

public static final InstantDocumentState DIRTY

The document is valid but has local changes that have not been synced to the server.

Note: If automatic syncing of local changes is not disabled (by using SYNC_LOCAL_CHANGES_DISABLED in setDelayForSyncingLocalChanges(long)) your changes will be sent to the server during the next sync cycle. If you have disabled automatic syncing, calling syncAnnotations() will sync all your local changes to the server and fetch the newest updates from it.

public static final InstantDocumentState INVALID

The document is invalid and cannot be used any longer.

Document transitions into this state when it gets invalidated due to:

You may want to remove its local storage via removeLocalStorage(), but that‘s about all you can do with it.

public static final InstantDocumentState NEEDS_RESET_FOR_DATABASE_MIGRATION

The current database version does not include required metadata on at least some records. The database will be usable in read-only mode until the local data has been replaced with an up-to-date snapshot from the server. Any pre-existing local changes will be sent to the server in the process. See "resetting for database migration".

public static final InstantDocumentState RECEIVING_CHANGES

The document is busy syncing — currently receiving changes from the server.

If the communication with the server fails, the document will fall back into the DIRTY or CLEAN state — depending on whether or not there are unsynced changes. If all goes well, this state will transition to either the CLEAN or the SENDING_CHANGES state — depending on whether new local changes have accumulated during the transmission. This will also notify all registered InstantDocumentListener.

Note: This repeated back and forth between the SENDING_CHANGES and #RECEIVING_CHANGES state is what we call the sync cycle. It starts when a sync request is made, and — if all goes well — ends when there are no local changes left.

public static final InstantDocumentState RESETTING_FOR_DATABASE_MIGRATION

The layer's record store is being updated with the latest server version. The database will be usable in read-only mode until this process completes. Any pre-existing local changes will be sent to the server before the local record store is purged. Upon success, we transition to state "clean".

public static final InstantDocumentState SENDING_CHANGES

The document is busy syncing — currently sending its local changes to the server.

If the communication with the server fails, the document will fall back into state DIRTY (and any registered InstantDocumentListener will be notified about sync error). If all goes well, this state will transition to RECEIVING_CHANGES (and any registered InstantDocumentListener will be notified).

public static final InstantDocumentState UNKNOWN

Document is in an unknown state. This goes away by the time you access a downloaded document for the first time.

Public Methods

public static InstantDocumentState valueOf (String name)

public static final InstantDocumentState[] values ()