// Token: 0x06002065 RID: 8293 RVA: 0x00096AF0 File Offset: 0x00094CF0
 public ReplicaInstancePreMountCallback(int storeMountFlags, AmMountFlags amMountFlags, MountDirectPerformanceTracker mountPerf, ReplicaInstance instance) : base(instance)
 {
     this.StoreMountFlags  = storeMountFlags;
     this.AmMountFlags     = amMountFlags;
     this.MountPerfTracker = mountPerf;
 }
        internal static void TryUpdateLastLogGenerationNumberOnMount(ReplayConfiguration config, LogStreamResetOnMount logReset, MountDirectPerformanceTracker mountPerf, int mountFlags, long highestLogGen)
        {
            bool flag = (mountFlags & 2) == 2;

            mountPerf.IsLossyMountEnabled = flag;
            mountPerf.HighestLogGenBefore = highestLogGen;
            mountPerf.HighestLogGenAfter  = highestLogGen;
            ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid, bool>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): fLossyMountEnabled = '{2}'", config.Name, config.IdentityGuid, flag);
            string logDirectory = config.DestinationLogPath;

            if (!flag)
            {
                long lowestLogGen = 0L;
                mountPerf.RunTimedOperation(MountDatabaseDirectOperation.LowestGenerationInDirectory, delegate
                {
                    lowestLogGen = ShipControl.LowestGenerationInDirectory(new DirectoryInfo(logDirectory), config.LogFilePrefix, "." + config.LogExtension, true);
                });
                if (lowestLogGen == 0L)
                {
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug((long)config.GetHashCode(), "Looks like a log stream reset");
                    logReset.ResetLogStream();
                    return;
                }
            }
            if (config.Type == ReplayConfigType.SingleCopySource)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid, ReplayConfigType>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Skipping updating last log generation since the config is of type '{2}'.", config.DisplayName, config.IdentityGuid, config.Type);
                return;
            }
            try
            {
                if (highestLogGen > 0L)
                {
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid, long>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Known highest log generation is {2}.", config.Name, config.IdentityGuid, highestLogGen);
                    mountPerf.RunTimedOperation(MountDatabaseDirectOperation.GenerationAvailableInDirectory, delegate
                    {
                        if (!ShipControl.GenerationAvailableInDirectory(new DirectoryInfo(logDirectory), config.LogFilePrefix, "." + config.LogExtension, highestLogGen))
                        {
                            ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Log file for known highest generation does not exist, will scan directory to determine the max generation.", config.Name, config.IdentityGuid);
                            highestLogGen = 0L;
                        }
                    });
                }
                if (highestLogGen <= 0L)
                {
                    mountPerf.RunTimedOperation(MountDatabaseDirectOperation.HighestGenerationInDirectory, delegate
                    {
                        highestLogGen = ShipControl.HighestGenerationInDirectory(new DirectoryInfo(logDirectory), config.LogFilePrefix, "." + config.LogExtension);
                    });
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Highest log in directory '{2}' is {3}.", new object[]
                    {
                        config.Name,
                        config.IdentityGuid,
                        logDirectory,
                        highestLogGen
                    });
                }
                mountPerf.HighestLogGenAfter = highestLogGen;
                if (highestLogGen <= 0L)
                {
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Skipping updating last log generation since highest log gen is <= 0.", config.Name, config.IdentityGuid);
                }
                else
                {
                    mountPerf.RunTimedOperation(MountDatabaseDirectOperation.UpdateLastLogGeneratedInClusDB, delegate
                    {
                        config.UpdateLastLogGeneratedAndEndOfLogInfo(highestLogGen);
                    });
                }
            }
            catch (IOException ex)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceError((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Caught IO exception for path '{2}'. {3}", new object[]
                {
                    config.Name,
                    config.IdentityGuid,
                    logDirectory,
                    ex
                });
            }
            catch (SecurityException ex2)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceError((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Caught SecurityException for path '{2}'. {3}", new object[]
                {
                    config.Name,
                    config.IdentityGuid,
                    logDirectory,
                    ex2
                });
            }
            catch (ClusterException arg)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceError <string, Guid, ClusterException>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Caught exception at SetLastLogGenerationNumber. {2}", config.Name, config.IdentityGuid, arg);
            }
        }