Enum InstantDocumentState

  • All Implemented Interfaces:

    
    public enum InstantDocumentState
    
                        

    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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      UNKNOWN

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

      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".

      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".

      CLEAN

      The document is valid and has no local changes.

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

      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) 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.

      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).

      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.

      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.

    • Method Summary

      Modifier and Type Method Description
      static Array<InstantDocumentState> values() Returns an array containing the constants of this enum type, in the order they're declared.
      static InstantDocumentState valueOf(String name) Returns the enum constant of this type with the specified name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • values

         static Array<InstantDocumentState> values()

        Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.

        Returns:

        an array containing the constants of this enum type, in the order they're declared

      • valueOf

         static InstantDocumentState valueOf(String name)

        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

        Returns:

        the enum constant with the specified name