// Token: 0x06000023 RID: 35 RVA: 0x00003060 File Offset: 0x00001260 private void FindEnd(DateTime end) { ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch LogCursor FindFindEnd"); this.endIdx = this.files.Count - 1; while (this.endIdx >= this.idx) { using (FileStream fileStream = CsvFieldCache.OpenLogFile(this.files[this.endIdx].FullName)) { if (fileStream != null) { CsvFieldCache csvFieldCache = new CsvFieldCache(this.table, this.schemaVersion, fileStream, 32768); this.table.ClusteredIndex.Find(end, csvFieldCache); this.totalBytes = this.totalBytes - this.files[this.endIdx].Length + csvFieldCache.Position; if (csvFieldCache.AtEnd) { this.endOffset = csvFieldCache.Position + 1L; } else { this.endOffset = csvFieldCache.Position; } break; } this.totalBytes -= this.files[this.endIdx].Length; this.endIdx--; } } }
// Token: 0x06000022 RID: 34 RVA: 0x00002EB0 File Offset: 0x000010B0 private void FindBeginning(DateTime begin) { ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch LogCursor FindBeginning"); this.idx = 0; while (this.idx < this.files.Count) { this.data = CsvFieldCache.OpenLogFile(this.files[this.idx].FullName); if (this.data == null) { this.totalBytes -= this.files[this.idx].Length; this.idx++; } else { this.cursor = new CsvFieldCache(this.table, this.schemaVersion, this.data, 32768); bool flag = this.table.ClusteredIndex.Find(begin, this.cursor); this.totalBytes = this.totalBytes - this.files[this.idx].Length + this.cursor.Length - this.cursor.Position; if (flag) { ExTraceGlobals.ServiceTracer.TraceError <string>((long)this.GetHashCode(), "MsExchangeLogSearch LogCursor FindBeginning found file {0} corrupted", this.data.Name); this.LogFileCorrupted(this.data.Name); } if (!this.cursor.AtEnd) { return; } ExTraceGlobals.ServiceTracer.TraceDebug <string>((long)this.GetHashCode(), "MsExchangeLogSearch LogCursor FindBeginning close file {0}", this.data.Name); this.data.Close(); this.data = null; this.cursor = null; this.idx++; } } }
// Token: 0x0600007C RID: 124 RVA: 0x00004880 File Offset: 0x00002A80 private LogFileInfo.OpenLogFileResult OpenLogFile() { FileStream fileStream = CsvFieldCache.OpenLogFile(this.fullName); if (fileStream == null) { return(null); } CsvFieldCache cursor = new CsvFieldCache(this.csvTable, fileStream, 32768); return(new LogFileInfo.OpenLogFileResult(cursor, fileStream)); }
// Token: 0x06000020 RID: 32 RVA: 0x00002C64 File Offset: 0x00000E64 private bool MoveNextPrivate() { ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch LogCursor MoveNextPrivate"); while (this.idx <= this.endIdx) { if (this.cursor != null) { bool flag; if (this.firstIsReady) { this.firstIsReady = false; flag = true; } else { long position = this.cursor.Position; flag = this.cursor.MoveNext(false); this.currentBytes += this.cursor.Position - position; } if (flag && (this.idx < this.endIdx || this.cursor.Position < this.endOffset)) { if (this.cursor.FieldCount != this.table.Fields.Length) { this.LogFileCorrupted(this.files[this.idx].FullName); } return(true); } ExTraceGlobals.ServiceTracer.TraceDebug <string>((long)this.GetHashCode(), "MsExchangeLogSearch LogCursor MoveNextPrivate close file {0}", this.data.Name); this.data.Close(); this.data = null; this.cursor = null; this.idx++; } else { this.data = CsvFieldCache.OpenLogFile(this.files[this.idx].FullName); if (this.data == null) { this.totalBytes -= this.files[this.idx].Length; this.idx++; } else { this.cursor = new CsvFieldCache(this.table, this.schemaVersion, this.data, 32768); this.totalBytes = this.totalBytes - this.files[this.idx].Length + this.cursor.Length; } } } return(false); }
// Token: 0x06000024 RID: 36 RVA: 0x0000319C File Offset: 0x0000139C public bool SearchNext(string column, string value) { if (this.fileEnumerator == null) { this.fileEnumerator = this.files.GetEnumerator(); if (!this.fileEnumerator.MoveNext()) { return(false); } this.offsetEnumerator = this.fileEnumerator.Current.GetOffsetsForData(column.ToLower(), value); } while (!this.offsetEnumerator.MoveNext()) { if (!this.fileEnumerator.MoveNext()) { return(false); } this.searchFileIdx++; this.offsetEnumerator = this.fileEnumerator.Current.GetOffsetsForData(column.ToLower(), value); } if ((ulong)this.offsetEnumerator.Current > (ulong)this.fileEnumerator.Current.Length) { return(false); } if (this.data != null) { this.data.Close(); this.cursor = null; } this.data = CsvFieldCache.OpenLogFile(this.fileEnumerator.Current.FullName); if (this.data == null) { ExTraceGlobals.ServiceTracer.TraceError <string>((long)this.GetHashCode(), "Unable to open logfile: {0}", this.fileEnumerator.Current.FullName); return(false); } this.cursor = new CsvFieldCache(this.table, this.schemaVersion, this.data, 32768); this.cursor.Seek((long)((ulong)this.offsetEnumerator.Current)); if (!this.cursor.MoveNext(false)) { return(false); } this.idx = this.searchFileIdx; this.currentBytes += (long)((ulong)this.offsetEnumerator.Current); this.totalBytes = this.totalBytes - this.files[this.searchFileIdx].Length + (long)((ulong)this.offsetEnumerator.Current); return(true); }
internal FileStream OpenLogWithRetry(string logFileName, out string logVersion) { FileStream fileStream = null; logVersion = string.Empty; for (int i = 0; i < 3; i++) { fileStream = CsvFieldCache.OpenLogFile(logFileName, out logVersion); if (fileStream != null) { ExTraceGlobals.ReaderTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Open Log file {0}, Version={1}", logFileName, logVersion); break; } if (this.CheckServiceStopRequest("OpenLogWithRetry()") || new FileInfo(logFileName).Length == 0L) { break; } Thread.Sleep((int)this.config.OpenFileRetryInterval.TotalMilliseconds); } return(fileStream); }
// Token: 0x0600009E RID: 158 RVA: 0x00005200 File Offset: 0x00003400 private List <uint> GetOffsetsForDataFast(string searchData) { uint hashCode = (uint)searchData.GetHashCode(); LogIndex.IndexRecord item = new LogIndex.IndexRecord(hashCode, 0U); int num = this.indexData.BinarySearch(item, LogIndex.IndexRecordComparer.Default); if (num < 0) { num = ~num; } List <uint> list = new List <uint>(); for (int i = num; i < this.indexData.Count; i++) { LogIndex.IndexRecord indexRecord = this.indexData[i]; uint offset = indexRecord.Offset; uint hashCode2 = indexRecord.HashCode; if (hashCode2 != hashCode) { break; } object obj; if (!IOHelper.TryIOOperation(() => CsvFieldCache.OpenLogFile(this.logFilePath), out obj) || obj == null) { ExTraceGlobals.ServiceTracer.TraceError <string>((long)this.GetHashCode(), "Search failed, unable to open file: {0}", this.logFilePath); throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_RPC_SERVER_UNAVAILABLE); } FileStream fileStream = (FileStream)obj; try { CsvFieldCache csvFieldCache = new CsvFieldCache(this.table, fileStream, 32768); if (offset != 0U) { csvFieldCache.Seek((long)((ulong)offset)); } long position = csvFieldCache.Position; while (csvFieldCache.MoveNext(false) && position - (long)((ulong)offset) <= (long)LogIndex.ClusterRange) { object field = csvFieldCache.GetField(this.columnIdToIndex); if (field == null) { break; } uint hashCode3; if (this.normalizeMethod != null) { hashCode3 = (uint)this.normalizeMethod((string)field).GetHashCode(); } else { hashCode3 = (uint)field.GetHashCode(); } if (hashCode3 == hashCode) { if (position > (long)((ulong)-1)) { break; } list.Add((uint)position); } position = csvFieldCache.Position; } } finally { if (fileStream != null) { fileStream.Close(); } } } return(list); }