Exemplo n.º 1
0
        // Token: 0x060000B3 RID: 179 RVA: 0x000052F4 File Offset: 0x000034F4
        private void PopulateBatch(IClusterDBWriteBatch writeBatch, Dictionary <AmServerName, AmCachedLastLogUpdater.ServerRequestInfo> requestInfoMap)
        {
            Dictionary <Guid, AmDbStateInfo> dbStateInfoMap = new Dictionary <Guid, AmDbStateInfo>();
            AmConfig config = AmSystemManager.Instance.Config;

            if (!config.IsPAM)
            {
                throw new AmInvalidConfiguration(string.Format("Role = {0}", config.Role));
            }
            AmDbStateInfo[] array = config.DbState.ReadAll();
            if (array != null)
            {
                dbStateInfoMap = array.ToDictionary((AmDbStateInfo s) => s.DatabaseGuid);
            }
            foreach (AmCachedLastLogUpdater.ServerRequestInfo serverRequestInfo in requestInfoMap.Values)
            {
                AmServerName            serverName        = serverRequestInfo.ServerName;
                Dictionary <Guid, long> databaseLogGenMap = serverRequestInfo.DatabaseLogGenMap;
                HashSet <Guid>          databasesByServer = this.GetDatabasesByServer(serverName);
                string value = serverRequestInfo.MostRecentRequestReceivedUtc.ToString("s");
                foreach (KeyValuePair <Guid, long> keyValuePair in databaseLogGenMap)
                {
                    Guid   key       = keyValuePair.Key;
                    long   value2    = keyValuePair.Value;
                    string text      = key.ToString();
                    string valueName = AmDbState.ConstructLastLogTimeStampProperty(text);
                    if (this.IsDatabaseActiveOnServer(dbStateInfoMap, key, serverName))
                    {
                        writeBatch.SetValue(text, value2.ToString());
                        writeBatch.SetValue(valueName, value);
                    }
                    databasesByServer.Remove(key);
                }
                foreach (Guid databaseGuid in databasesByServer)
                {
                    string valueName2 = AmDbState.ConstructLastLogTimeStampProperty(databaseGuid.ToString());
                    if (this.IsDatabaseActiveOnServer(dbStateInfoMap, databaseGuid, serverName))
                    {
                        writeBatch.SetValue(valueName2, value);
                    }
                }
                writeBatch.SetValue(serverName.NetbiosName, value);
            }
        }
Exemplo n.º 2
0
        public bool GetLastLogGenerationTimeStamp(Guid dbGuid, out ExDateTime lastLogGenTimeStamp)
        {
            string text  = AmDbState.ConstructLastLogTimeStampProperty(dbGuid.ToString());
            string empty = string.Empty;

            lastLogGenTimeStamp = ExDateTime.MinValue;
            bool lastLogPropertyInternal = this.GetLastLogPropertyInternal(text, out empty);

            if (lastLogPropertyInternal && !ExDateTime.TryParse(empty, out lastLogGenTimeStamp))
            {
                AmTrace.Error("GetLastLogPropertyInternal() returned a value that could not be parsed. DB: '{0}'; Value: {1}", new object[]
                {
                    text,
                    empty
                });
                throw new AmLastLogPropertyCorruptedException(text, empty);
            }
            return(lastLogPropertyInternal);
        }
Exemplo n.º 3
0
        public void SetLastLogGenerationTimeStamp(Guid dbGuid, ExDateTime timeStamp)
        {
            string name = AmDbState.ConstructLastLogTimeStampProperty(dbGuid.ToString());

            this.SetLastLogPropertyInternal(name, timeStamp.ToString("s"));
        }