Пример #1
0
        /// <summary>
        /// Initiates the asynchronous execution of the SplitShard operation.
        /// <seealso cref="Amazon.Kinesis.IAmazonKinesis.SplitShard"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the SplitShard operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <SplitShardResponse> SplitShardAsync(SplitShardRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new SplitShardRequestMarshaller();
            var unmarshaller = SplitShardResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, SplitShardRequest, SplitShardResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
Пример #2
0
        internal SplitShardResponse SplitShard(SplitShardRequest request)
        {
            var marshaller   = new SplitShardRequestMarshaller();
            var unmarshaller = SplitShardResponseUnmarshaller.Instance;

            return(Invoke <SplitShardRequest, SplitShardResponse>(request, marshaller, unmarshaller));
        }
Пример #3
0
        /// <summary>
        /// Initiates the asynchronous execution of the SplitShard operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the SplitShard operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <SplitShardResponse> SplitShardAsync(SplitShardRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new SplitShardRequestMarshaller();
            var unmarshaller = SplitShardResponseUnmarshaller.Instance;

            return(InvokeAsync <SplitShardRequest, SplitShardResponse>(request, marshaller,
                                                                       unmarshaller, cancellationToken));
        }
Пример #4
0
 public Task <IResponse <IList <ShardInfo> > > SplitShardAsync(SplitShardRequest request)
 {
     return(SendRequestAsync <IList <ShardInfo> >(
                new HttpRequestMessageBuilder(HttpMethod.Post,
                                              $"/logstores/{request.LogstoreName}/shards/{request.ShardId}")
                .Query("action", "split")
                .Query("key", request.SplitKey),
                project: request.ProjectName));
 }
Пример #5
0
        /// <summary>
        /// <para>This operation splits a shard into two new shards in the stream, to increase the stream's capacity to ingest and transport data.
        /// <c>SplitShard</c> is called when there is a need to increase the overall capacity of stream because of an expected increase in the volume of
        /// data records being ingested. </para> <para> <c>SplitShard</c> can also be used when a given shard appears to be approaching its maximum
        /// utilization, for example, when the set of producers sending data into the specific shard are suddenly sending more than previously
        /// anticipated. You can also call the <c>SplitShard</c> operation to increase stream capacity, so that more Amazon Kinesis applications can
        /// simultaneously read data from the stream for real-time processing. </para> <para>The <c>SplitShard</c> operation requires that you specify
        /// the shard to be split and the new hash key, which is the position in the shard where the shard gets split in two. In many cases, the new
        /// hash key might simply be the average of the beginning and ending hash key, but it can be any hash key value in the range being mapped into
        /// the shard. For more information about splitting shards, see the <a href="http://docs.aws.amazon.com/kinesis/latest/dev/">Amazon Kinesis
        /// Developer Guide</a> .
        /// </para> <para>You can use the DescribeStream operation to determine the shard ID and hash key values for the <c>ShardToSplit</c>
        /// and <c>NewStartingHashKey</c> parameters that are specified in the <c>SplitShard</c> request.</para> <para> <c>SplitShard</c> is an
        /// asynchronous operation. Upon receiving a <c>SplitShard</c> request, Amazon Kinesis immediately returns a response and sets the stream status
        /// to UPDATING. After the operation is completed, Amazon Kinesis sets the stream status to ACTIVE. Read and write operations continue to work
        /// while the stream is in the UPDATING state. </para> <para>You can use <c>DescribeStream</c> to check the status of the stream, which is
        /// returned in <c>StreamStatus</c> .
        /// If the stream is in the ACTIVE state, you can call <c>SplitShard</c> .
        /// If a stream is in CREATING or UPDATING or DELETING states, then Amazon Kinesis returns a <c>ResourceInUseException</c> .</para>
        /// <para>If the specified stream does not exist, Amazon Kinesis returns a <c>ResourceNotFoundException</c> .
        /// If you try to create more shards than are authorized for your account, you receive a <c>LimitExceededException</c> .
        /// </para> <para> <b>Note:</b> The default limit for an AWS account is 10 shards per stream. If you need to create a stream with more than 10
        /// shards, <a href="http://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html">contact AWS Support</a> to increase the limit on
        /// your account.</para> <para>If you try to operate on too many streams in parallel using CreateStream, DeleteStream, MergeShards or
        /// SplitShard, you will receive a <c>LimitExceededException</c> . </para> <para> <c>SplitShard</c> has limit of 5 transactions per second per
        /// account.</para>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the SplitShard service method on AmazonKinesis.</param>
        ///
        /// <exception cref="T:Amazon.Kinesis.Model.LimitExceededException" />
        /// <exception cref="T:Amazon.Kinesis.Model.ResourceInUseException" />
        /// <exception cref="T:Amazon.Kinesis.Model.InvalidArgumentException" />
        /// <exception cref="T:Amazon.Kinesis.Model.ResourceNotFoundException" />
        public SplitShardResponse SplitShard(SplitShardRequest request)
        {
            var task = SplitShardAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
Пример #6
0
        public SplitShardResponse SplitShard(Shard shard)
        {
            var startingHashKey    = BigInteger.Parse(shard.HashKeyRange.StartingHashKey);
            var endingHashKey      = BigInteger.Parse(shard.HashKeyRange.EndingHashKey);
            var newStartingHashKey = BigInteger.Divide(BigInteger.Add(startingHashKey, endingHashKey), new BigInteger(2));

            var splitShardRequest = new SplitShardRequest {
                StreamName = _streamName, ShardToSplit = shard.ShardId, NewStartingHashKey = newStartingHashKey.ToString()
            };

            var response = AsyncHelper.RunSync(() => _client.SplitShardAsync(splitShardRequest));

            return(response);
        }
Пример #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the SplitShard operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the SplitShard operation on AmazonKinesisClient.</param>
        /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
        /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        public void SplitShardAsync(SplitShardRequest request, AmazonServiceCallback <SplitShardRequest, SplitShardResponse> callback, AsyncOptions options = null)
        {
            options = options == null?new AsyncOptions():options;
            var marshaller   = new SplitShardRequestMarshaller();
            var unmarshaller = SplitShardResponseUnmarshaller.Instance;
            Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;

            if (callback != null)
            {
                callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => {
                    AmazonServiceResult <SplitShardRequest, SplitShardResponse> responseObject
                        = new AmazonServiceResult <SplitShardRequest, SplitShardResponse>((SplitShardRequest)req, (SplitShardResponse)res, ex, ao.State);
                    callback(responseObject);
                }
            }
            ;
            BeginInvoke <SplitShardRequest>(request, marshaller, unmarshaller, options, callbackHelper);
        }
Пример #8
0
 /// <summary>
 /// This operation splits a shard into two new shards in the stream, to
 /// increase the stream's capacity to ingest and transport data.
 /// More info: http://docs.aws.amazon.com/kinesis/latest/APIReference/API_SplitShard.html
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public SplitShardResponse SplitShard(SplitShardRequest request)
 {
     return(Invoke <SplitShardResponse>(request, "SplitShard"));
 }
 public void SplitShardAsync(SplitShardRequest request, AmazonServiceCallback <SplitShardRequest, SplitShardResponse> callback, AsyncOptions options = null)
 {
     throw new System.NotImplementedException();
 }