Exemplo n.º 1
0
        public RangeMapping <TKey> UpdateMapping(RangeMapping <TKey> currentMapping, RangeMappingUpdate update,
                                                 MappingLockToken mappingLockToken)
        {
            ExceptionUtils.DisallowNullArgument(currentMapping, "currentMapping");
            ExceptionUtils.DisallowNullArgument(update, "update");
            ExceptionUtils.DisallowNullArgument(mappingLockToken, "mappingLockToken");

            using (ActivityIdScope activityIdScope = new ActivityIdScope(Guid.NewGuid()))
            {
                Tracer.TraceInfo(TraceSourceConstants.ComponentNames.RangeShardMap,
                                 "UpdateMapping", "Start; Current mapping shard: {0}",
                                 currentMapping.Shard.Location);

                Stopwatch stopwatch = Stopwatch.StartNew();

                RangeMapping <TKey> rangeMapping = this.rsm.Update(currentMapping, update, mappingLockToken.LockOwnerId, MappingOptions.Validate);

                stopwatch.Stop();

                Tracer.TraceInfo(TraceSourceConstants.ComponentNames.RangeShardMap,
                                 "UpdateMapping", "Complete; Current mapping shard: {0}; Duration: {1}",
                                 currentMapping.Shard.Location, stopwatch.Elapsed);

                return(rangeMapping);
            }
        }
 /// <summary>
 /// Allows for update to a range 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 RangeMapping <TKey> Update(RangeMapping <TKey> currentMapping, RangeMappingUpdate update, Guid lockOwnerId)
 {
     return(this.Update <RangeMapping <TKey>, RangeMappingUpdate, MappingStatus>(
                currentMapping,
                update,
                (smm, sm, ssm) => new RangeMapping <TKey>(smm, sm, ssm),
                rms => (int)rms,
                i => (MappingStatus)i,
                lockOwnerId));
 }
Exemplo n.º 3
0
 public RangeMapping <TKey> UpdateMapping(RangeMapping <TKey> currentMapping, RangeMappingUpdate update)
 {
     return(this.UpdateMapping(currentMapping, update, MappingLockToken.NoLock));
 }