/// <summary>
        /// Constructs a range mapping given mapping creation arguments.
        /// </summary>
        /// <param name="manager">Owning ShardMapManager.</param>
        /// <param name="creationInfo">Mapping creation information.</param>
        internal RangeMapping(ShardMapManager manager, RangeMappingCreationInfo <TKey> creationInfo)
        {
            Debug.Assert(manager != null);
            Debug.Assert(creationInfo != null);
            Debug.Assert(creationInfo.Shard != null);

            this.Manager = manager;
            _shard       = creationInfo.Shard;

            this.StoreMapping = new DefaultStoreMapping(
                Guid.NewGuid(),
                creationInfo.Shard,
                creationInfo.Range.Low.RawValue,
                creationInfo.Range.High.RawValue,
                (int)creationInfo.Status);

            this.Range = creationInfo.Range;
            this.Value = creationInfo.Value;
        }
        public RangeMapping <TKey> CreateRangeMapping(RangeMappingCreationInfo <TKey> creationInfo)
        {
            ExceptionUtils.DisallowNullArgument(creationInfo, "args");

            using (ActivityIdScope activityIdScope = new ActivityIdScope(Guid.NewGuid()))
            {
                Tracer.TraceInfo(TraceSourceConstants.ComponentNames.RangeShardMap,
                                 "CreateRangeMapping", "Start; Shard: {0}", creationInfo.Shard.Location);

                Stopwatch stopwatch = Stopwatch.StartNew();

                RangeMapping <TKey> rangeMapping = this.rsm.Add(new RangeMapping <TKey>(this.Manager, creationInfo));

                stopwatch.Stop();

                Tracer.TraceInfo(TraceSourceConstants.ComponentNames.RangeShardMap,
                                 "CreateRangeMapping", "Complete; Shard: {0}; Duration: {1}",
                                 creationInfo.Shard.Location, stopwatch.Elapsed);

                return(rangeMapping);
            }
        }