internal Dictionary <Guid, AmDbStateInfo> GetAllDbStatesFromClusdb(IClusterDB clusdb) { Dictionary <Guid, AmDbStateInfo> dictionary = new Dictionary <Guid, AmDbStateInfo>(); if (!DistributedStore.Instance.IsKeyExist("ExchangeActiveManager\\DbState", null)) { return(dictionary); } IEnumerable <Tuple <string, RegistryValueKind> > valueInfos = clusdb.GetValueInfos("ExchangeActiveManager\\DbState"); if (valueInfos != null) { foreach (Tuple <string, RegistryValueKind> tuple in valueInfos) { string item = tuple.Item1; string value = clusdb.GetValue <string>("ExchangeActiveManager\\DbState", item, string.Empty); Guid guid; if (!string.IsNullOrEmpty(value) && Guid.TryParse(item, out guid)) { AmDbStateInfo value2 = AmDbStateInfo.Parse(guid, value); dictionary.Add(guid, value2); } } } return(dictionary); }
// Token: 0x06000313 RID: 787 RVA: 0x00011B78 File Offset: 0x0000FD78 internal static AmDbStateInfo ReplaceProperty(AmDbStateInfo oldStateInfo, AmDbStateInfo.PropertyNames propName, string propValue) { bool isPropExist = false; string str = oldStateInfo.ToString(); StringBuilder sb = new StringBuilder(500); AmDbStateInfo.ParseNameValuePairs(str, delegate(string name, string value) { if (AmDbStateInfo.IsMatching(name, propName)) { if (!isPropExist) { AmDbStateInfo.AppendNameValue(sb, propName.ToString(), propValue); isPropExist = true; return; } } else { AmDbStateInfo.AppendNameValue(sb, name, value); } }); if (!isPropExist) { AmDbStateInfo.AppendNameValue(sb, propName.ToString(), propValue); } return(AmDbStateInfo.Parse(oldStateInfo.DatabaseGuid, sb.ToString())); }
// Token: 0x06000442 RID: 1090 RVA: 0x00016A44 File Offset: 0x00014C44 protected override AmDbStateInfo[] ReadAllInternal(bool isBestEffort) { List <AmDbStateInfo> list = new List <AmDbStateInfo>(); try { IEnumerable <Tuple <string, object> > allValues = this.m_regDbHandle.GetAllValues(null); if (allValues != null) { foreach (Tuple <string, object> tuple in allValues) { try { Guid databaseGuid = new Guid(tuple.Item1); string entryStr = (string)tuple.Item2; AmDbStateInfo item = AmDbStateInfo.Parse(databaseGuid, entryStr); list.Add(item); } catch (InvalidCastException ex) { AmTrace.Error("ReadAllInternal invalid cast exception: {0}", new object[] { ex }); if (!isBestEffort) { throw; } } catch (FormatException ex2) { AmTrace.Error("ReadAllInternal format exception: {0}", new object[] { ex2 }); if (!isBestEffort) { throw; } } } } } catch (ClusterException ex3) { AmTrace.Error("ReadAllInternal({0}): GetValueNames() failed with error {1}", new object[] { isBestEffort, ex3.Message }); if (!isBestEffort) { throw; } } return(list.ToArray()); }
internal AmDbStatusInfo2 GetEntry(Guid databaseGuid) { AmConfig config = AmSystemManager.Instance.Config; if (config.IsUnknown) { AmTrace.Error("GetSFD: Invalid configuration (db={0})", new object[] { databaseGuid }); throw new AmInvalidConfiguration(config.LastError); } string text = config.DbState.ReadStateString(databaseGuid); AmServerDbStatusInfoCache.StringStatusInfoPair stringStatusInfoPair = null; AmDbStatusInfo2 amDbStatusInfo = null; lock (this.m_locker) { this.m_cacheMap.TryGetValue(databaseGuid, out stringStatusInfoPair); } if (stringStatusInfoPair != null && text != null && string.Equals(text, stringStatusInfoPair.RawStateString)) { amDbStatusInfo = stringStatusInfoPair.StatusInfo; } else { AmDbStateInfo stateInfo = AmDbStateInfo.Parse(databaseGuid, text); amDbStatusInfo = AmServerDbStatusInfoCache.ConvertToDbStatusInfo(stateInfo); stringStatusInfoPair = new AmServerDbStatusInfoCache.StringStatusInfoPair(text, amDbStatusInfo); lock (this.m_locker) { AmTrace.Debug("Updating cache for database {0}.", new object[] { databaseGuid }); this.m_cacheMap[databaseGuid] = stringStatusInfoPair; } } return(amDbStatusInfo); }
internal AmDbStateInfo Read(Guid dbGuid, bool isBestEffort) { AmDbStateInfo result = new AmDbStateInfo(dbGuid); string empty = string.Empty; try { bool flag = this.ReadInternal(dbGuid.ToString(), out empty); if (flag && !string.IsNullOrEmpty(empty)) { result = AmDbStateInfo.Parse(dbGuid, empty); } } catch (FormatException ex) { AmTrace.Error("Failed to parse the state info string '{1}' for Database '{0}'. Error: {2}", new object[] { dbGuid, empty, ex }); if (!isBestEffort) { throw new AmInvalidDbStateException(dbGuid, empty, ex); } } catch (ClusterException ex2) { AmTrace.Error("Attempt read persistent database state for Database '{0}' failed with error: {1}", new object[] { dbGuid, ex2 }); if (!isBestEffort) { throw; } } return(result); }