Ejemplo n.º 1
0
        private async Task <IGetReplicaResult> GetReplica(string id, short index, IInternalSpan span, CancellationToken cancellationToken, ITranscoderOverrideOptions options)
        {
            using var childSpan = _tracer.InternalSpan(OperationNames.ReplicaRead, span);
            using var getOp     = new ReplicaRead <object>
                  {
                      Key        = id,
                      Cid        = Cid,
                      CName      = Name,
                      ReplicaIdx = index,
                      Span       = childSpan
                  };
            _operationConfigurator.Configure(getOp, options);

            await _bucket.RetryAsync(getOp, cancellationToken).ConfigureAwait(false);

            return(new GetReplicaResult(getOp.ExtractBody(), getOp.Transcoder, _getLogger)
            {
                Id = getOp.Key,
                Cas = getOp.Cas,
                OpCode = getOp.OpCode,
                Flags = getOp.Flags,
                Header = getOp.Header,
                IsActive = false
            });
        }
Ejemplo n.º 2
0
        private async Task <IGetReplicaResult> GetReplica(string id, short index, IRequestSpan span,
                                                          CancellationToken cancellationToken, ITranscoderOverrideOptions options)
        {
            using var childSpan = _tracer.RequestSpan(OuterRequestSpans.ServiceSpan.Kv.ReplicaRead, span);
            using var getOp     = new ReplicaRead <object>(id, index)
                  {
                      Key   = id,
                      Cid   = Cid,
                      CName = Name,
                      SName = ScopeName,
                      Span  = childSpan
                  };
            _operationConfigurator.Configure(getOp, options);

            using var cts =
                      CreateRetryTimeoutCancellationTokenSource((ITimeoutOptions)options, getOp, out var tokenPair);
            await _bucket.RetryAsync(getOp, tokenPair).ConfigureAwait(false);

            return(new GetReplicaResult(getOp.ExtractBody(), getOp.Transcoder, _getLogger)
            {
                Id = getOp.Key,
                Cas = getOp.Cas,
                OpCode = getOp.OpCode,
                Flags = getOp.Flags,
                Header = getOp.Header,
                IsActive = false
            });
        }
Ejemplo n.º 3
0
        private async Task <IGetReplicaResult> GetPrimary(string id, IInternalSpan span, CancellationToken cancellationToken, ITranscoderOverrideOptions options)
        {
            using var childSpan = _tracer.InternalSpan(OperationNames.Get, span);
            using var getOp     = new Get <object>
                  {
                      Key   = id,
                      Cid   = Cid,
                      CName = Name,
                      Span  = childSpan
                  };
            _operationConfigurator.Configure(getOp, options);

            using var cts = CreateRetryTimeoutCancellationTokenSource((ITimeoutOptions)options, getOp);
            await _bucket.RetryAsync(getOp, cts.Token).ConfigureAwait(false);

            return(new GetReplicaResult(getOp.ExtractBody(), getOp.Transcoder, _getLogger)
            {
                Id = getOp.Key,
                Cas = getOp.Cas,
                OpCode = getOp.OpCode,
                Flags = getOp.Flags,
                Header = getOp.Header,
                IsActive = true
            });
        }