Package com.couchbase.client.vbucket.config

Examples of com.couchbase.client.vbucket.config.Config


   * @param key the key to check for.
   * @return true if there is a master assigned for the key.
   */
  public boolean hasActiveMaster(String key) {
    TotalConfig totConfig = fullConfig.get();
    Config config = totConfig.getConfig();
    int vbucket = config.getVbucketByKey(key);
    VBucket bucket = config.getVbuckets().get(vbucket);
    return bucket.getMaster() != -1;
  }
View Full Code Here


      boolean warmedUp = false;
      int maxBackoffRetries = 5;
      int retryCount = 1;
      while(!warmedUp) {
        readPools(bucketname);
        Config config = this.buckets.get(bucketname).getConfig();
        if(config.getConfigType().equals(ConfigType.MEMCACHE)) {
          warmedUp = true;
          continue;
        }
        if(config.getVbucketsCount() == 0) {
          if(retryCount > maxBackoffRetries) {
            throw new ConfigurationException("Cluster is not in a warmed up "
              + "state after " + maxBackoffRetries + " exponential retries.");
          }
          int backoffSeconds = new Double(
View Full Code Here

  }

  @Override
  public MemcachedConnection createConnection(List<InetSocketAddress> addrs)
    throws IOException {
    Config config = getVBucketConfig();
    if (config.getConfigType() == ConfigType.MEMCACHE) {
      return new CouchbaseMemcachedConnection(getReadBufSize(), this, addrs,
        getInitialObservers(), getFailureMode(), getOperationFactory());
    } else if (config.getConfigType() == ConfigType.COUCHBASE) {
      return new CouchbaseConnection(getReadBufSize(), this, addrs,
        getInitialObservers(), getFailureMode(), getOperationFactory());
    }
    throw new IOException("No ConnectionFactory for bucket type "
      + config.getConfigType());
  }
View Full Code Here

    return new ViewConnection(this, addrs, bucket, pass);
  }

  @Override
  public NodeLocator createLocator(List<MemcachedNode> nodes) {
    Config config = getVBucketConfig();

    if (config == null) {
      throw new IllegalStateException("Couldn't get config");
    }

    if (config.getConfigType() == ConfigType.MEMCACHE) {
      return new KetamaNodeLocator(nodes, DefaultHashAlgorithm.KETAMA_HASH);
    } else if (config.getConfigType() == ConfigType.COUCHBASE) {
      return new VBucketNodeLocator(nodes, getVBucketConfig());
    } else {
      throw new IllegalStateException("Unhandled locator type: "
          + config.getConfigType());
    }
  }
View Full Code Here

TOP

Related Classes of com.couchbase.client.vbucket.config.Config

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.