Example #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);
        }
Example #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);
     }
 }