Ejemplo n.º 1
0
        public override InternalIndexState GetInitialState(StoreIndexDescriptor descriptor)
        {
            TemporalIndexFiles temporalIndexFiles = new TemporalIndexFiles(DirectoryStructure(), descriptor, _fs);

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

            foreach (TemporalIndexFiles.FileLayout 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);
        }
Ejemplo n.º 2
0
 public override InternalIndexState GetInitialState(StoreIndexDescriptor descriptor)
 {
     try
     {
         return(NativeIndexes.ReadState(PageCache, NativeIndexFileFromIndexId(descriptor.Id)));
     }
     catch (Exception e) when(e is MetadataMismatchException || e is IOException)
     {
         Monitor.failedToOpenIndex(descriptor, "Requesting re-population.", e);
         return(InternalIndexState.POPULATING);
     }
 }
Ejemplo n.º 3
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)
        {
            try
            {
                string failureMessage = NativeIndexes.ReadFailureMessage(PageCache, NativeIndexFileFromIndexId(descriptor.Id));
                if (string.ReferenceEquals(failureMessage, null))
                {
                    throw new System.InvalidOperationException("Index " + descriptor.Id + " isn't failed");
                }
                return(failureMessage);
            }
            catch (IOException e)
            {
                throw new Exception(e);
            }
        }
Ejemplo n.º 4
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)
        {
            TemporalIndexFiles temporalIndexFiles = new TemporalIndexFiles(DirectoryStructure(), descriptor, _fs);

            try
            {
                foreach (TemporalIndexFiles.FileLayout subIndex in temporalIndexFiles.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");
        }