public DesignDocManager(CouchbaseClientConfiguration config) { if (_cluster == null) { _config = config; _cluster = new CouchbaseCluster(config); } }
public DesignDocManager(string sectionName = "couchbase") { if (_cluster == null) { _config = ConfigurationManager.GetSection(sectionName) as CouchbaseClientSection; _cluster = new CouchbaseCluster(_config); } }
public IMemcachedClient Create(ICouchbaseClientConfiguration config) { if (config == null) { throw new InvalidOperationException("Invalid Couchbase Configuration section: "); } return(new CouchbaseClient(config)); }
public static string GetConfig(this ICouchbaseClientConfiguration config) { var converter = new JsonSerializerSettings { ContractResolver = new InterfaceContractResolver() }; return(JsonConvert.SerializeObject(config, converter)); }
/// <summary> /// Initializes a new instance of the <see cref="T:Couchbase.CouchbasePool" /> class using the specified configuration, /// bucket name and password. /// </summary> /// <param name="configuration">The configuration to be used.</param> /// <param name="bucketName">The name of the bucket to connect to. Overrides the configuration's Bucket property.</param> /// <param name="bucketPassword">The password to the bucket. Overrides the configuration's BucketPassword property.</param> public CouchbasePool(ICouchbaseClientConfiguration configuration, string bucketName, string bucketPassword) { if (configuration == null) { throw new ArgumentNullException("configuration"); } this.Initialize(configuration, bucketName, bucketPassword); }
public CouchbaseNode(IPEndPoint endpoint, Uri couchApiBase, ICouchbaseClientConfiguration config, ISaslAuthenticationProvider authenticationProvider) : base(endpoint, config.SocketPool, authenticationProvider) { var ub = new UriBuilder(couchApiBase); ub.Path = System.IO.Path.Combine(ub.Path, "_design"); this.Client = config.CreateHttpClient(ub.Uri); this.Client.RetryCount = config.RetryCount; }
public DatabaseHelperTest() { cf = DatabaseHelper.GetCouchbaseClientConfiguration(); if (!DatabaseHelper.ExistBucket(cf.Bucket)) { CreateBucket(); } repository = new Repository(cf.Bucket); repository.CreateDefaultViews(); }
static CouchbaseCacheProvider() { log = LoggerProvider.LoggerFor(typeof(CouchbaseCacheProvider)); config = ConfigurationManager.GetSection("couchbase") as ICouchbaseClientConfiguration; if (config == null) { log.Info("couchbase configuration section not found, using default configuration (127.0.0.1:8091)."); config = new CouchbaseClientConfiguration(); config.Urls.Add(new UriBuilder("http://", IPAddress.Loopback.ToString(), 8091, "pools").Uri); } }
static CouchbaseCacheProvider() { log = LoggerProvider.LoggerFor(typeof (CouchbaseCacheProvider)); config = ConfigurationManager.GetSection("couchbase") as ICouchbaseClientConfiguration; if (config == null) { log.Info("couchbase configuration section not found, using default configuration (127.0.0.1:8091)."); config = new CouchbaseClientConfiguration(); config.Urls.Add(new UriBuilder("http://", IPAddress.Loopback.ToString(),8091, "pools").Uri); } }
public CouchbaseNode(IPEndPoint endpoint, Uri couchApiBase, ICouchbaseClientConfiguration config, ISaslAuthenticationProvider provider) { var uriBuilder = new UriBuilder(couchApiBase); uriBuilder.Path = Path.Combine(uriBuilder.Path, "_design"); _config = config; _client = config.CreateHttpClient(uriBuilder.Uri); _client.RetryCount = config.RetryCount; _endpoint = endpoint; _pool = new SocketPool(this, config.SocketPool, provider); }
public static void LogConfig(this ICouchbaseClientConfiguration config, ILog log, Guid clientId) { if (log.IsInfoEnabled) { try { log.InfoFormat("CID Config: {0} {1}", clientId, GetConfig(config)); } catch (Exception e) { log.Error(e); } } }
protected CouchbaseClient(ICouchbaseServerPool pool, ICouchbaseClientConfiguration configuration) : base(pool, configuration.CreateKeyTransformer(), configuration.CreateTranscoder(), configuration.CreatePerformanceMonitor()) { this.documentNameTransformer = configuration.CreateDesignDocumentNameTransformer(); this.poolInstance = (ICouchbaseServerPool)this.Pool; observeTimeout = configuration.ObserveTimeout; StoreOperationResultFactory = new DefaultStoreOperationResultFactory(); GetOperationResultFactory = new DefaultGetOperationResultFactory(); MutateOperationResultFactory = new DefaultMutateOperationResultFactory(); ConcatOperationResultFactory = new DefaultConcatOperationResultFactory(); RemoveOperationResultFactory = new DefaultRemoveOperationResultFactory(); }
public CouchbaseCluster(ICouchbaseClientConfiguration config) { _username = config.Username; _password = config.Password; try { _bucketUri = getBucketUri(config.Urls); } catch (Exception ex) { if (_logger.IsErrorEnabled) _logger.Error("Error bootstrapping to cluster", ex); if (BootstrapFailed != null) BootstrapFailed(ex); _bucketUri = null; } }
public ReadOnlyConfig(ICouchbaseClientConfiguration original) { this.bucket = original.Bucket; this.bucketPassword = original.BucketPassword; this.username = original.Username; this.password = original.Password; this.urls = original.Urls.ToArray(); this.retryCount = original.RetryCount; this.retryTimeout = original.RetryTimeout; this.observeTimeout = original.ObserveTimeout; this.spc = new SPC(original.SocketPool); this.hbm = new HBM(original.HeartbeatMonitor); this.original = original; }
private static void InitConfig() { try { var cc = Z.C.AppConfigHandler.GetConfig <CouchCacheConfig>(FileTools.FindFile("couchCache.config").FullName); config = new CouchbaseClientConfiguration() { Bucket = cc.BucketName, BucketPassword = cc.BucketPassword, }; config.Urls.Add(new Uri(cc.Uri)); } catch (Exception ex) { logger.Error(ex); throw new Exception("CouchCache configuration exception.", ex); } }
private void Initialize(ICouchbaseClientConfiguration configuration, string bucketName, string bucketPassword) { var roc = new ReadOnlyConfig(configuration); // make null both if we use the default bucket since we do not need to be authenticated if (String.IsNullOrEmpty(bucketName) || bucketName == "default") { bucketName = null; bucketPassword = null; } else { bucketPassword = bucketPassword ?? String.Empty; } roc.OverrideBucket(bucketName, bucketPassword); this.configuration = roc; this.deadTimeoutMsec = (long)this.configuration.SocketPool.DeadTimeout.TotalMilliseconds; }
public CouchbaseCluster(ICouchbaseClientConfiguration config) { _username = config.Username; _password = config.Password; try { _bucketUri = getBucketUri(config.Urls); } catch (Exception ex) { if (_logger.IsErrorEnabled) { _logger.Error("Error bootstrapping to cluster", ex); } if (BootstrapFailed != null) { BootstrapFailed(ex); } _bucketUri = null; } }
private static void InitConfig() { try { var cc = Z.C.AppConfigHandler.GetConfig<CouchCacheConfig>(FileTools.FindFile("couchCache.config").FullName); config = new CouchbaseClientConfiguration() { Bucket = cc.BucketName, BucketPassword = cc.BucketPassword, }; config.Urls.Add(new Uri(cc.Uri)); } catch (Exception ex) { logger.Error(ex); throw new Exception("CouchCache configuration exception.", ex); } }
/// <summary> /// Initializes a new instance of the <see cref="T:Membase.MembasePool" /> class using the specified configuration, /// bucket name and password. /// </summary> /// <param name="configuration">The configuration to be used.</param> /// <param name="bucketName">The name of the bucket to connect to. Overrides the configuration's Bucket property.</param> /// <param name="bucketPassword">The password to the bucket. Overrides the configuration's BucketPassword property.</param> public CouchbasePool(ICouchbaseClientConfiguration configuration, string bucketName, string bucketPassword) : base(configuration, bucketName, bucketPassword) { this.configuration = configuration; }
public CouchbasePool(ICouchbaseClientConfiguration configuration, string bucket) { throw new InvalidOperationException("Use .ctor(config, bucket, password) to explicitly set the bucket password."); }
/// <summary> /// Initializes a new instance of the <see cref="T:Couchbase.CouchbaseClient" /> class using a custom configuration provider. /// </summary> /// <param name="configuration">The custom configuration provider.</param> public CouchbaseClient(ICouchbaseClientConfiguration configuration) : this(configuration, configuration.Bucket, configuration.BucketPassword) { }
/// <summary> /// Initializes a new instance of the <see cref="T:Couchbase.CouchbasePool" /> class using the specified configuration, /// bucket name and password. /// </summary> /// <param name="configuration">The configuration to be used.</param> /// <param name="bucketName">The name of the bucket to connect to. Overrides the configuration's Bucket property.</param> /// <param name="bucketPassword">The password to the bucket. Overrides the configuration's BucketPassword property.</param> public CouchbasePool(ICouchbaseClientConfiguration configuration, string bucketName, string bucketPassword) { if (configuration == null) throw new ArgumentNullException("configuration"); this.Initialize(configuration, bucketName, bucketPassword); }
/// <summary> /// Initializes a new instance of the <see cref="T:Membase.MembasePool" />. /// </summary> /// <param name="configuration">The configuration to be used.</param> public CouchbasePool(ICouchbaseClientConfiguration configuration) : this(configuration, configuration.Bucket, configuration.BucketPassword) { }
/// <summary> /// Initializes a new instance of the <see cref="T:Couchbase.CouchbaseClient" /> class /// using a custom configuration provider and the specified bucket name and password. /// </summary> /// <param name="configuration">The custom configuration provider.</param> /// <param name="bucketName">The name of the bucket this client will connect to.</param> /// <param name="bucketPassword">The password of the bucket this client will connect to.</param> public CouchbaseClient(ICouchbaseClientConfiguration configuration, string bucketName, string bucketPassword) : this(new CouchbasePool(ThrowIfNull(configuration, "configuration"), bucketName, bucketPassword), configuration) { }
public ReadOnlyConfig(ICouchbaseClientConfiguration original) { this.bucket = original.Bucket; this.bucketPassword = original.BucketPassword; this.username = original.Username; this.password = original.Password; this.urls = original.Urls.ToArray(); this.retryCount = original.RetryCount; this.retryTimeout = original.RetryTimeout; this.observeTimeout = original.ObserveTimeout; this.httpRequestTimeout = original.HttpRequestTimeout; this.spc = new SPC(original.SocketPool); this.hbm = new HBM(original.HeartbeatMonitor); this.hcc = new HCC(original.HttpClient); this.original = original; _vBucketRetryCount = original.VBucketRetryCount; }
public ReadOnlyConfig(ICouchbaseClientConfiguration original) { this.bucket = original.Bucket; this.bucketPassword = original.BucketPassword; this.urls = original.Urls.ToArray(); this.retryCount = original.RetryCount; this.retryTimeout = original.RetryTimeout; this.spc = new SPC(original.SocketPool); this.original = original; }