Ejemplo n.º 1
0
 public BucketFactory(
     ClusterContext clusterContext,
     IScopeFactory scopeFactory,
     IRetryOrchestrator retryOrchestrator,
     IVBucketKeyMapperFactory vBucketKeyMapperFactory,
     IKetamaKeyMapperFactory ketamaKeyMapperFactory,
     ILogger <CouchbaseBucket> couchbaseLogger,
     ILogger <MemcachedBucket> memcachedLogger,
     TypedRedactor redactor,
     IBootstrapperFactory bootstrapperFactory,
     IRequestTracer tracer,
     IOperationConfigurator operationConfigurator,
     IRetryStrategy retryStrategy,
     IHttpClusterMapFactory httpClusterMapFactory
     )
 {
     _clusterContext          = clusterContext ?? throw new ArgumentNullException(nameof(clusterContext));
     _scopeFactory            = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory));
     _retryOrchestrator       = retryOrchestrator ?? throw new ArgumentNullException(nameof(retryOrchestrator));
     _vBucketKeyMapperFactory = vBucketKeyMapperFactory ?? throw new ArgumentNullException(nameof(vBucketKeyMapperFactory));
     _ketamaKeyMapperFactory  = ketamaKeyMapperFactory ?? throw new ArgumentNullException(nameof(ketamaKeyMapperFactory));
     _couchbaseLogger         = couchbaseLogger ?? throw new ArgumentNullException(nameof(couchbaseLogger));
     _memcachedLogger         = memcachedLogger ?? throw new ArgumentNullException(nameof(memcachedLogger));
     _redactor            = redactor ?? throw new ArgumentNullException(nameof(IRedactor));
     _bootstrapperFactory = bootstrapperFactory ?? throw new ArgumentNullException(nameof(bootstrapperFactory));
     _tracer = tracer ?? throw new ArgumentNullException(nameof(tracer));
     _operationConfigurator = operationConfigurator ?? throw new ArgumentNullException(nameof(operationConfigurator));
     _retryStrategy         = retryStrategy ?? throw new ArgumentNullException(nameof(retryStrategy));
     _httpClusterMapFactory = httpClusterMapFactory ?? throw new ArgumentNullException(nameof(httpClusterMapFactory));
 }
 public ClusterNodeFactory(ClusterContext clusterContext, IConnectionPoolFactory connectionPoolFactory, ILogger <ClusterNode> logger,
                           ObjectPool <OperationBuilder> operationBuilderPool, ICircuitBreaker circuitBreaker, ISaslMechanismFactory saslMechanismFactory,
                           TypedRedactor redactor, IRequestTracer tracer)
 {
     _clusterContext        = clusterContext ?? throw new ArgumentNullException(nameof(clusterContext));
     _connectionPoolFactory = connectionPoolFactory ?? throw new ArgumentNullException(nameof(connectionPoolFactory));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _operationBuilderPool = operationBuilderPool ?? throw new ArgumentNullException(nameof(operationBuilderPool));
     _circuitBreaker       = circuitBreaker ?? throw new ArgumentException(nameof(circuitBreaker));
     _saslMechanismFactory = saslMechanismFactory ?? throw new ArgumentNullException(nameof(saslMechanismFactory));
     _redactor             = redactor ?? throw new ArgumentNullException(nameof(redactor));
     _tracer = tracer ?? throw new ArgumentNullException(nameof(tracer));
 }
Ejemplo n.º 3
0
        public void When_Redaction_Disabled_No_Redaction_Occurs()
        {
            var options = new ClusterOptions
            {
                RedactionLevel = RedactionLevel.None
            };

            var redactor = new TypedRedactor(options);

            Assert.Equal("1", redactor.UserData("1").ToString());
            Assert.Equal("", redactor.MetaData((string)null).ToString());
            Assert.Equal("system", redactor.SystemData("system").ToString());
        }
Ejemplo n.º 4
0
        public void SpanFormattable_Redacts_Properly()
        {
            var options = new ClusterOptions
            {
                RedactionLevel = RedactionLevel.Full
            };

            var redactor        = new TypedRedactor(options);
            var spanFormattable = new HostEndpointWithPort("localhost", 8675309);
            var asString        = $"{redactor.UserData(spanFormattable)} is formatted";

            Assert.Contains("</ud>", asString);
        }
Ejemplo n.º 5
0
        public void When_Full_Redaction_Redact_Everything()
        {
            var options = new ClusterOptions
            {
                RedactionLevel = RedactionLevel.Full
            };

            var redactor = new TypedRedactor(options);

            Assert.Equal("<ud>user</ud>", redactor.UserData("user").ToString());
            Assert.Equal("<md>meta</md>", redactor.MetaData("meta").ToString());
            Assert.Equal("<sd>system</sd>", redactor.SystemData("system").ToString());
        }
Ejemplo n.º 6
0
        public void When_User_Redaction_Redact_Partial()
        {
            var options = new ClusterOptions
            {
                RedactionLevel = RedactionLevel.Partial
            };

            var redactor = new TypedRedactor(options);

            Assert.Equal("<ud>user</ud>", redactor.UserData("user").ToString());
            Assert.Equal("meta", redactor.MetaData("meta").ToString());
            Assert.Equal("system", redactor.SystemData("system").ToString());
        }
Ejemplo n.º 7
0
 public void BaselineSetup()
 {
     _redactor = new TypedRedactor(Level);
 }
        internal CouchbaseBucket(string name, ClusterContext context, IScopeFactory scopeFactory, IRetryOrchestrator retryOrchestrator,
                                 IVBucketKeyMapperFactory vBucketKeyMapperFactory, ILogger <CouchbaseBucket> logger, TypedRedactor redactor, IBootstrapperFactory bootstrapperFactory,
                                 IRequestTracer tracer, IOperationConfigurator operationConfigurator, IRetryStrategy retryStrategy, BucketConfig config)
            : base(name, context, scopeFactory, retryOrchestrator, logger, redactor, bootstrapperFactory, tracer, operationConfigurator, retryStrategy, config)
        {
            _vBucketKeyMapperFactory = vBucketKeyMapperFactory ?? throw new ArgumentNullException(nameof(vBucketKeyMapperFactory));

            _viewClientLazy = new Lazy <IViewClient>(() =>
                                                     context.ServiceProvider.GetRequiredService <IViewClient>()
                                                     );
            _viewManagerLazy = new Lazy <IViewIndexManager>(() =>
                                                            new ViewIndexManager(name,
                                                                                 context.ServiceProvider.GetRequiredService <IServiceUriProvider>(),
                                                                                 context.ServiceProvider.GetRequiredService <ICouchbaseHttpClientFactory>(),
                                                                                 context.ServiceProvider.GetRequiredService <ILogger <ViewIndexManager> >(),
                                                                                 context.ServiceProvider.GetRequiredService <IRedactor>()));

            _collectionManagerLazy = new Lazy <ICouchbaseCollectionManager>(() =>
                                                                            new CollectionManager(name,
                                                                                                  context.ServiceProvider.GetRequiredService <IServiceUriProvider>(),
                                                                                                  context.ServiceProvider.GetRequiredService <ICouchbaseHttpClientFactory>(),
                                                                                                  context.ServiceProvider.GetRequiredService <ILogger <CollectionManager> >(),
                                                                                                  context.ServiceProvider.GetRequiredService <IRedactor>())
                                                                            );
        }
Ejemplo n.º 9
0
 public RetryOrchestrator(ILogger <RetryOrchestrator> logger, TypedRedactor redactor)
 {
     _logger   = logger ?? throw new ArgumentNullException(nameof(logger));
     _redactor = redactor ?? throw new ArgumentNullException(nameof(redactor));
 }
Ejemplo n.º 10
0
 internal MemcachedBucket(string name, ClusterContext context, IScopeFactory scopeFactory, IRetryOrchestrator retryOrchestrator, IKetamaKeyMapperFactory ketamaKeyMapperFactory,
                          ILogger <MemcachedBucket> logger, IHttpClusterMapFactory httpClusterMapFactory, TypedRedactor redactor, IBootstrapperFactory bootstrapperFactory, IRequestTracer tracer, IOperationConfigurator operationConfigurator, IRetryStrategy retryStrategy, BucketConfig config)
     : base(name, context, scopeFactory, retryOrchestrator, logger, redactor, bootstrapperFactory, tracer, operationConfigurator, retryStrategy, config)
 {
     BucketType = BucketType.Memcached;
     Name       = name;
     _ketamaKeyMapperFactory = ketamaKeyMapperFactory ?? throw new ArgumentNullException(nameof(ketamaKeyMapperFactory));
     _httpClusterMapFactory  = httpClusterMapFactory ?? throw new ArgumentNullException(nameof(httpClusterMapFactory));
     _httpClusterMap         = _httpClusterMapFactory.Create(Context);
 }
Ejemplo n.º 11
0
 internal MemcachedBucket(string name, ClusterContext context, IScopeFactory scopeFactory, IRetryOrchestrator retryOrchestrator, IKetamaKeyMapperFactory ketamaKeyMapperFactory,
                          ILogger <MemcachedBucket> logger, TypedRedactor redactor, IBootstrapperFactory bootstrapperFactory, IRequestTracer tracer, IOperationConfigurator operationConfigurator, IRetryStrategy retryStrategy, IHttpClusterMapFactory httpClusterMapFactory, BucketConfig config) :
     this(name, context, scopeFactory, retryOrchestrator, ketamaKeyMapperFactory, logger,
          httpClusterMapFactory, redactor, bootstrapperFactory, tracer, operationConfigurator, retryStrategy, config)
 {
 }