Class FormatVersion

    • Method Detail

      • canRead

        public boolean canRead​(FormatVersion other)
        Returns true if this version can read data written by the other version.
        Parameters:
        other - the version the data was written in.
        Returns:
        true if this version can read, false otherwise.
      • versionOf

        @NotNull
        public static @NotNull FormatVersion versionOf​(@NotNull
                                                       @NotNull DocumentStore store)
                                                throws DocumentStoreException
        Reads the FormatVersion from the given store. This method returns V0 if the store currently does not have a version set.
        Parameters:
        store - the store to read from.
        Returns:
        the format version of the store.
        Throws:
        DocumentStoreException - if an error occurs while reading from the store.
      • writeTo

        public boolean writeTo​(@NotNull
                               @NotNull DocumentStore store)
                        throws DocumentStoreException
        Writes this version to the given document store. The write operation will fail with a DocumentStoreException if the version change is considered incompatible or cannot be applied for some other reason. This includes:
        • An attempt to downgrade the existing version
        • There are active cluster nodes using an existing version
        • The version was changed concurrently
        Parameters:
        store - the document store.
        Returns:
        true if the version in the store was updated, false otherwise. This method will also return false if the version in the store equals this version and now update was required.
        Throws:
        DocumentStoreException - if the write operation fails. Reasons include: 1) an attempt to downgrade the existing version, 2) there are active cluster nodes using an existing version, 3) the version was changed concurrently.
      • valueOf

        public static FormatVersion valueOf​(String s)
                                     throws IllegalArgumentException
        Returns a format version for the given String representation. This method either returns one of the well known versions or an entirely new version if the version is not well known.
        Parameters:
        s - the String representation of a format version.
        Returns:
        the parsed format version.
        Throws:
        IllegalArgumentException - if the string is malformed.