public EntityBatchRelationship(string relationshipName, string parentUniqueRelationshipName, RecordKeyType linkOn, List <string> childFieldNamesToMatchOn) { if (String.IsNullOrWhiteSpace(relationshipName)) { throw new Exception("Relationship name is missing or empty."); } if (String.IsNullOrWhiteSpace(parentUniqueRelationshipName)) { throw new Exception("Parent relationship name is missing or empty."); } if (childFieldNamesToMatchOn == null || childFieldNamesToMatchOn.Count == 0) { throw new Exception("At least one child field name is required."); } if (childFieldNamesToMatchOn.Exists(d => String.IsNullOrWhiteSpace(d))) { throw new Exception("One or more child field names are missing or empty."); } Name = relationshipName; ParentUniqueRelationshipName = parentUniqueRelationshipName; LinkOn = linkOn; ChildFieldNamesToMatchOn = childFieldNamesToMatchOn; }
private static UserProfileKey GetLadderRecordKey(RecordKeyType recordType, Product client) { if (!Enum.IsDefined(typeof(RecordKeyType), recordType)) { throw new InvalidEnumArgumentException("recordType", (int)recordType, typeof(RecordKeyType)); } string key = null; switch (recordType) { case RecordKeyType.Wins: key = LADDER_WINS; break; case RecordKeyType.Losses: key = LADDER_LOSSES; break; case RecordKeyType.Disconnects: key = LADDER_DISCONNECTS; break; case RecordKeyType.LastGame: key = LADDER_LAST_GAME; break; case RecordKeyType.LastGameResult: key = LADDER_LAST_RESULT; break; case RecordKeyType.Rating: key = LADDER_RATING; break; case RecordKeyType.HighRating: key = LADDER_HIGH_RATING; break; case RecordKeyType.Rank: key = LADDER_RANK; break; case RecordKeyType.HighRank: key = LADDER_HIGH_RANK; break; } key = string.Format(CultureInfo.InvariantCulture, key, client.ProductCode); return(new UserProfileKey(key)); }
/// <summary> /// Gets a user profile key for the specified type of statistic. /// </summary> /// <param name="profileType">The type of statistic (ladder, non-ladder).</param> /// <param name="recordType">The type of record (wins, losses).</param> /// <param name="client">The client for which to request.</param> /// <returns>A non-writeable UserProfileKey.</returns> /// <exception cref="InvalidEnumArgumentException">Thrown if <paramref name="profileType"/> or <paramref name="recordType"/> /// are values that are not defined by their enumerations.</exception> /// <exception cref="ArgumentOutOfRangeException">If the product specified by <paramref name="client"/> was invalid, or if the /// type of profile or record was not appropriate for the client (for example, IronMan Ladder is only valid for Warcraft II: /// Battle.net Edition).</exception> public static UserProfileKey GetRecordKey(ProfileRecordKeyType profileType, RecordKeyType recordType, Product client) { if (profileType == ProfileRecordKeyType.IronManLadder && client != Product.Warcraft2BNE) { throw new InvalidEnumArgumentException("profileType", (int)profileType, typeof(ProfileRecordKeyType)); } switch (profileType) { case ProfileRecordKeyType.Normal: return(GetRecordKey(recordType, client)); case ProfileRecordKeyType.Ladder: return(GetLadderRecordKey(recordType, client)); case ProfileRecordKeyType.IronManLadder: return(GetIronManLadderRecordKey(recordType, client)); default: throw new InvalidEnumArgumentException("profileType", (int)profileType, typeof(ProfileRecordKeyType)); } }
private static UserProfileKey GetRecordKey(RecordKeyType recordType, Product client) { if (!Enum.IsDefined(typeof(RecordKeyType), recordType)) { throw new InvalidEnumArgumentException("recordType", (int)recordType, typeof(RecordKeyType)); } if (recordType >= RecordKeyType.Rating) { throw new ArgumentOutOfRangeException("recordType", "Non-ladder keys may not be requested for the Normal profile record types."); } string key = null; switch (recordType) { case RecordKeyType.Wins: key = NORMAL_WINS; break; case RecordKeyType.Losses: key = NORMAL_LOSSES; break; case RecordKeyType.Disconnects: key = NORMAL_DISCONNECTS; break; case RecordKeyType.LastGame: key = NORMAL_LAST_GAME; break; case RecordKeyType.LastGameResult: key = NORMAL_LAST_RESULT; break; } key = string.Format(CultureInfo.InvariantCulture, key, client.ProductCode); return(new UserProfileKey(key)); }
/// <summary> /// Gets a user profile key for the specified type of statistic. /// </summary> /// <param name="profileType">The type of statistic (ladder, non-ladder).</param> /// <param name="recordType">The type of record (wins, losses).</param> /// <param name="client">The client for which to request.</param> /// <returns>A non-writeable UserProfileKey.</returns> /// <exception cref="InvalidEnumArgumentException">Thrown if <paramref name="profileType"/> or <paramref name="recordType"/> /// are values that are not defined by their enumerations.</exception> /// <exception cref="ArgumentOutOfRangeException">If the product specified by <paramref name="client"/> was invalid, or if the /// type of profile or record was not appropriate for the client (for example, IronMan Ladder is only valid for Warcraft II: /// Battle.net Edition).</exception> public static UserProfileKey GetRecordKey(ProfileRecordKeyType profileType, RecordKeyType recordType, Product client) { if (profileType == ProfileRecordKeyType.IronManLadder && client != Product.Warcraft2BNE) throw new InvalidEnumArgumentException("profileType", (int)profileType, typeof(ProfileRecordKeyType)); switch (profileType) { case ProfileRecordKeyType.Normal: return GetRecordKey(recordType, client); case ProfileRecordKeyType.Ladder: return GetLadderRecordKey(recordType, client); case ProfileRecordKeyType.IronManLadder: return GetIronManLadderRecordKey(recordType, client); default: throw new InvalidEnumArgumentException("profileType", (int)profileType, typeof(ProfileRecordKeyType)); } }
public EntityBatchRelationship(string relationshipName, string parentUniqueRelationshipName, RecordKeyType linkOn, string childFieldNameToMatchOn) : this(relationshipName, parentUniqueRelationshipName, linkOn, new List <string>() { childFieldNameToMatchOn }) { }
internal IEnumerable<KeyValuePair<RecordKey, RecordData>> fetchLogEntries( string log_server_guid, RecordKeyType log_start_key, int limit = -1, bool block = false) { var rk_start = new RecordKey() .appendKeyPart("_logs") .appendKeyPart(log_server_guid); if (!log_start_key.Equals("")) { rk_start.appendKeyPart(log_start_key); } var rk_end = new RecordKey() .appendKeyPart("_logs") .appendKeyPart(log_server_guid); var scanrange = new ScanRange<RecordKey>(rk_start, RecordKey.AfterPrefix(rk_end), null); Console.WriteLine(" fetchLogEntries (block:{3}) for ({0}): start {1} end {2}", log_server_guid, rk_start, rk_end, block); bool matched_first = false; int count = 0; retry_log_fetch: foreach (var logrow in next_stage.scanForward(scanrange)) { if (!matched_first) { // the first logrow needs to match the log_start_key, or there was a gap in the log!! var logstamp = logrow.Key.key_parts[2]; if (logstamp.CompareTo(log_start_key) != 0) { throw new LogException( String.Format("log start gap! guid:{0} log_start_key:{1} logstamp:{2}", log_server_guid,log_start_key,logstamp)); } matched_first = true; continue; } yield return logrow; count++; // if we're limiting the number of return rows... if (limit != -1) { if (count > limit) { yield break; } } } if (!matched_first) { throw new LogException("no log entries!"); } // if we only matched one log row, then it should be the matching first row. if ((count == 0) && block) { Console.WriteLine("++++++++ block on log tail"); lock (this.logWaiters) { Monitor.Wait(this.logWaiters); } Console.WriteLine("++++++++ wakeup from log tail"); goto retry_log_fetch; } }
public int getEstimatedRemainingLogData(string server_guid, RecordKeyType log_start_key) { int count = 0; // TODO: build a more efficient way to get this by asking the MTree for the size between keys foreach (var log_line in this.fetchLogEntries(server_guid,log_start_key)) { count++; } return count; }
public int getEstimatedRemainingLogData(string server_guid, RecordKeyType log_start_key) { return hndl.getEstimatedRemainingLogData(server_guid, log_start_key); }
public IEnumerable<KeyValuePair<RecordKey, RecordData>> fetchLogEntries( string log_server_guid, RecordKeyType log_start_key, bool block = false) { return hndl.fetchLogEntries(log_server_guid, log_start_key, block:block); }
public ActionResult GenerateStructure(Catalog CatalogID, List<FieldList> FieldIDs, RecordKeyType RecordKeyType, RecordCompareType RecordCompareType, List<long> RecordKeyFieldIDs, List<long> RecordCompareFieldIDs, bool ForceUpdateWithNoCompare, bool RunAsTransaction) { CatalogueDefinition catalogueDefinition = new CatalogueDefinition(); catalogueDefinition.Catalog = CatalogID; catalogueDefinition.Fields = FieldIDs; catalogueDefinition.RecordKeyType = RecordKeyType; catalogueDefinition.RecordCompareType = RecordCompareType; catalogueDefinition.RecordKeyFieldIDs = RecordKeyFieldIDs; catalogueDefinition.RecordCompareFieldIDs = RecordCompareFieldIDs; catalogueDefinition.ForceUpdateWithNoCompare = ForceUpdateWithNoCompare; catalogueDefinition.RunAsTransaction = RunAsTransaction; string catalogInit = Utils.ConvertCatalogueDefinitionDataToXML(catalogueDefinition); return Json(catalogInit); }
private static UserProfileKey GetRecordKey(RecordKeyType recordType, Product client) { if (!Enum.IsDefined(typeof(RecordKeyType), recordType)) throw new InvalidEnumArgumentException("recordType", (int)recordType, typeof(RecordKeyType)); if (recordType >= RecordKeyType.Rating) throw new ArgumentOutOfRangeException("recordType", "Non-ladder keys may not be requested for the Normal profile record types."); string key = null; switch (recordType) { case RecordKeyType.Wins: key = NORMAL_WINS; break; case RecordKeyType.Losses: key = NORMAL_LOSSES; break; case RecordKeyType.Disconnects: key = NORMAL_DISCONNECTS; break; case RecordKeyType.LastGame: key = NORMAL_LAST_GAME; break; case RecordKeyType.LastGameResult: key = NORMAL_LAST_RESULT; break; } key = string.Format(CultureInfo.InvariantCulture, key, client.ProductCode); return new UserProfileKey(key); }
private static UserProfileKey GetLadderRecordKey(RecordKeyType recordType, Product client) { if (!Enum.IsDefined(typeof(RecordKeyType), recordType)) throw new InvalidEnumArgumentException("recordType", (int)recordType, typeof(RecordKeyType)); string key = null; switch (recordType) { case RecordKeyType.Wins: key = LADDER_WINS; break; case RecordKeyType.Losses: key = LADDER_LOSSES; break; case RecordKeyType.Disconnects: key = LADDER_DISCONNECTS; break; case RecordKeyType.LastGame: key = LADDER_LAST_GAME; break; case RecordKeyType.LastGameResult: key = LADDER_LAST_RESULT; break; case RecordKeyType.Rating: key = LADDER_RATING; break; case RecordKeyType.HighRating: key = LADDER_HIGH_RATING; break; case RecordKeyType.Rank: key = LADDER_RANK; break; case RecordKeyType.HighRank: key = LADDER_HIGH_RANK; break; } key = string.Format(CultureInfo.InvariantCulture, key, client.ProductCode); return new UserProfileKey(key); }
public EntityBatchRelationship AssociateParent(string parentUniqueRelationshipName, RecordKeyType linkOn, List <string> childFieldNamesToMatchOn) { var relationship = new EntityBatchRelationship("ParentRel_" + Guid.NewGuid().ToString(), parentUniqueRelationshipName, linkOn, childFieldNamesToMatchOn); AssociateParent(relationship); return(relationship); }
public EntityBatchRelationship AssociateParent(string parentUniqueRelationshipName, RecordKeyType linkOn, string childFieldNameToMatchOn) { return(AssociateParent(parentUniqueRelationshipName, linkOn, new List <string>() { childFieldNameToMatchOn })); }
public void AddAutoBindingForeignKey(string foreignKeyFieldToUpdate, int parentPrimaryKeyColumnIdx, string parentUniqueRelationshipName, RecordKeyType linkOn, List <string> childFieldNamesToMatchOn) { if (String.IsNullOrWhiteSpace(foreignKeyFieldToUpdate)) { throw new Exception("Foreign key field to update is missing or empty."); } var foreignKeyRelationship = new EntityBatchRelationship("AutoBindingForeignKey_" + Guid.NewGuid().ToString(), parentUniqueRelationshipName, linkOn, childFieldNamesToMatchOn); AssociateParent(foreignKeyRelationship); AutoBindingForeignKeys.Add(new AutoBindingForeignKey(foreignKeyRelationship, foreignKeyFieldToUpdate, parentPrimaryKeyColumnIdx)); }
public void AddAutoBindingForeignKey(string foreignKeyFieldToUpdate, int parentPrimaryKeyColumnIdx, string parentUniqueRelationshipName, RecordKeyType linkOn, string childFieldNameToMatchOn) { AddAutoBindingForeignKey(foreignKeyFieldToUpdate, parentPrimaryKeyColumnIdx, parentUniqueRelationshipName, linkOn, new List <string>() { childFieldNameToMatchOn }); }
/// <summary> /// Defaults to parent's first primary key column (idx = 0). /// </summary> public void AddAutoBindingForeignKey(string foreignKeyFieldToUpdate, string parentUniqueRelationshipName, RecordKeyType linkOn, List <string> childFieldNamesToMatchOn) { AddAutoBindingForeignKey(foreignKeyFieldToUpdate, 0, parentUniqueRelationshipName, linkOn, childFieldNamesToMatchOn); }
/// <summary> /// Defaults to parent's first primary key column (idx = 0). /// </summary> public void AddAutoBindingForeignKey(string foreignKeyFieldToUpdate, string parentEntityName, RecordKeyType linkOn, string childFieldNameToMatchOn) { AddAutoBindingForeignKey(foreignKeyFieldToUpdate, 0, parentEntityName, linkOn, new List <string>() { childFieldNameToMatchOn }); }