Class MetaStateService

    • Method Detail

      • loadIndexState

        @Nullable
        public IndexMetaData loadIndexState​(Index index)
                                     throws java.io.IOException
        Loads the index state for the provided index name, returning null if doesn't exists.
        Throws:
        java.io.IOException
      • loadManifestOrEmpty

        public Manifest loadManifestOrEmpty()
                                     throws java.io.IOException
        Loads Manifest file from disk, returns Manifest.empty() if there is no manifest file.
        Throws:
        java.io.IOException
      • writeManifestAndCleanup

        public void writeManifestAndCleanup​(java.lang.String reason,
                                            Manifest manifest)
                                     throws WriteStateException
        Writes manifest file (represented by Manifest) to disk and performs cleanup of old manifest state file if the write succeeds or newly created manifest state if the write fails.
        Throws:
        WriteStateException - if exception when writing state occurs. See also WriteStateException.isDirty()
      • cleanupIndex

        public void cleanupIndex​(Index index,
                                 long currentGeneration)
        Removes old state files in index directory.
        Parameters:
        index - index to perform clean up on.
        currentGeneration - current state generation to keep in the index directory.
      • writeIndexAndUpdateManifest

        public void writeIndexAndUpdateManifest​(java.lang.String reason,
                                                IndexMetaData metaData)
                                         throws java.io.IOException
        Writes index metadata and updates manifest file accordingly. Used by tests.
        Throws:
        java.io.IOException
      • writeGlobalStateAndUpdateManifest

        public void writeGlobalStateAndUpdateManifest​(java.lang.String reason,
                                                      MetaData metaData)
                                               throws java.io.IOException
        Writes global metadata and updates manifest file accordingly. Used by tests.
        Throws:
        java.io.IOException