Esempio n. 1
0
        public PointMapping <TKey> UpdateMapping(PointMapping <TKey> currentMapping, PointMappingUpdate update,
                                                 MappingLockToken mappingLockToken)
        {
            ExceptionUtils.DisallowNullArgument(currentMapping, "currentMapping");
            ExceptionUtils.DisallowNullArgument(update, "update");
            ExceptionUtils.DisallowNullArgument(mappingLockToken, "mappingLockToken");

            using (ActivityIdScope activityIdScope = new ActivityIdScope(Guid.NewGuid()))
            {
                string mappingKey = BitConverter.ToString(currentMapping.Key.RawValue);
                Tracer.TraceInfo(TraceSourceConstants.ComponentNames.ListShardMap,
                                 "UpdatePointMapping", "Start; ShardMap name: {0}; Current Point Mapping: {1}",
                                 this.Name, mappingKey);

                Stopwatch stopwatch = Stopwatch.StartNew();

                PointMapping <TKey> pointMapping = _lsm.Update(currentMapping, update, mappingLockToken.LockOwnerId);

                stopwatch.Stop();

                Tracer.TraceInfo(TraceSourceConstants.ComponentNames.ListShardMap,
                                 "UpdatePointMapping", "Complete; ShardMap name: {0}; Current Point Mapping: {1}; Duration: {2}",
                                 this.Name, mappingKey, stopwatch.Elapsed);

                return(pointMapping);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Allows for update to a point mapping with the updates provided in
 /// the <paramref name="update"/> parameter.
 /// </summary>
 /// <param name="currentMapping">Mapping being updated.</param>
 /// <param name="update">Updated properties of the Shard.</param>
 /// <param name="lockOwnerId">Lock owner id of this mapping</param>
 /// <returns>New instance of mapping with updated information.</returns>
 internal PointMapping <TKey> Update(PointMapping <TKey> currentMapping, PointMappingUpdate update, Guid lockOwnerId = default(Guid))
 {
     return(this.Update <PointMapping <TKey>, PointMappingUpdate, MappingStatus>(
                currentMapping,
                update,
                (smm, sm, ssm) => new PointMapping <TKey>(smm, sm, ssm),
                pms => (int)pms,
                i => (MappingStatus)i,
                lockOwnerId));
 }
Esempio n. 3
0
 public PointMapping <TKey> UpdateMapping(PointMapping <TKey> currentMapping, PointMappingUpdate update)
 {
     return(this.UpdateMapping(currentMapping, update, MappingLockToken.NoLock));
 }