Exemplo n.º 1
0
        public override InternalIndexState GetInitialState(StoreIndexDescriptor descriptor)
        {
            SpatialIndexFiles spatialIndexFiles = new SpatialIndexFiles(DirectoryStructure(), descriptor.Id, _fs, _configuredSettings);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Iterable<SpatialIndexFiles.SpatialFile> existing = spatialIndexFiles.existing();
            IEnumerable <SpatialIndexFiles.SpatialFile> existing = spatialIndexFiles.Existing();
            InternalIndexState state = InternalIndexState.ONLINE;

            foreach (SpatialIndexFiles.SpatialFile subIndex in existing)
            {
                try
                {
                    switch (NativeIndexes.ReadState(_pageCache, subIndex.IndexFile))
                    {
                    case FAILED:
                        return(InternalIndexState.FAILED);

                    case POPULATING:
                        state = InternalIndexState.POPULATING;
                        goto default;

                    default:                              // continue
                        break;
                    }
                }
                catch (Exception e) when(e is MetadataMismatchException || e is IOException)
                {
                    _monitor.failedToOpenIndex(descriptor, "Requesting re-population.", e);
                    return(InternalIndexState.POPULATING);
                }
            }
            return(state);
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public String getPopulationFailure(org.neo4j.storageengine.api.schema.StoreIndexDescriptor descriptor) throws IllegalStateException
        public override string GetPopulationFailure(StoreIndexDescriptor descriptor)
        {
            SpatialIndexFiles spatialIndexFiles = new SpatialIndexFiles(DirectoryStructure(), descriptor.Id, _fs, _configuredSettings);

            try
            {
                foreach (SpatialIndexFiles.SpatialFile subIndex in spatialIndexFiles.Existing())
                {
                    string indexFailure = NativeIndexes.ReadFailureMessage(_pageCache, subIndex.IndexFile);
                    if (!string.ReferenceEquals(indexFailure, null))
                    {
                        return(indexFailure);
                    }
                }
            }
            catch (IOException e)
            {
                throw new Exception(e);
            }
            throw new System.InvalidOperationException("Index " + descriptor.Id + " isn't failed");
        }