com.couchbase.client.vbucket.config
Class DefaultConfig

java.lang.Object
  extended by com.couchbase.client.vbucket.config.DefaultConfig
All Implemented Interfaces:
Config

public class DefaultConfig
extends java.lang.Object
implements Config

A DefaultConfig.


Constructor Summary
DefaultConfig(net.spy.memcached.HashAlgorithm hashAlgorithm, int serversCount, int replicasCount, int vbucketsCount, java.util.List<java.lang.String> servers, java.util.List<VBucket> vbuckets, java.util.List<java.net.URL> couchServers)
           
 
Method Summary
 ConfigDifference compareTo(Config config)
          Compares the given configuration with the current configuration and calculates the differences.
 int foundIncorrectMaster(int vbucket, int wrongServer)
           
 ConfigType getConfigType()
           
 java.util.List<java.net.URL> getCouchServers()
           
 net.spy.memcached.HashAlgorithm getHashAlgorithm()
           
 int getMaster(int vbucketIndex)
           
 int getReplica(int vbucketIndex, int replicaIndex)
           
 int getReplicasCount()
           
 java.lang.String getServer(int serverIndex)
           
 java.util.List<java.lang.String> getServers()
           
 int getServersCount()
           
 int getVbucketByKey(java.lang.String key)
           
 java.util.List<VBucket> getVbuckets()
           
 int getVbucketsCount()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConfig

public DefaultConfig(net.spy.memcached.HashAlgorithm hashAlgorithm,
                     int serversCount,
                     int replicasCount,
                     int vbucketsCount,
                     java.util.List<java.lang.String> servers,
                     java.util.List<VBucket> vbuckets,
                     java.util.List<java.net.URL> couchServers)
Method Detail

getReplicasCount

public int getReplicasCount()
Specified by:
getReplicasCount in interface Config

getVbucketsCount

public int getVbucketsCount()
Specified by:
getVbucketsCount in interface Config

getServersCount

public int getServersCount()
Specified by:
getServersCount in interface Config

getServer

public java.lang.String getServer(int serverIndex)
Specified by:
getServer in interface Config

getVbucketByKey

public int getVbucketByKey(java.lang.String key)
Specified by:
getVbucketByKey in interface Config

getMaster

public int getMaster(int vbucketIndex)
Specified by:
getMaster in interface Config

getReplica

public int getReplica(int vbucketIndex,
                      int replicaIndex)
Specified by:
getReplica in interface Config

getCouchServers

public java.util.List<java.net.URL> getCouchServers()
Specified by:
getCouchServers in interface Config

foundIncorrectMaster

public int foundIncorrectMaster(int vbucket,
                                int wrongServer)
Specified by:
foundIncorrectMaster in interface Config

getServers

public java.util.List<java.lang.String> getServers()
Specified by:
getServers in interface Config

getVbuckets

public java.util.List<VBucket> getVbuckets()
Specified by:
getVbuckets in interface Config

compareTo

public ConfigDifference compareTo(Config config)
Compares the given configuration with the current configuration and calculates the differences. Note that if a MEMCACHE type config is used, only the servers are compared because MEMCACHE buckets do not contain vBuckets. If COUCHBASE configs are compared, also the vBucket changes are taken into account.

Specified by:
compareTo in interface Config
Parameters:
config - the new config to compare against.
Returns:
the differences between the configurations.

getHashAlgorithm

public net.spy.memcached.HashAlgorithm getHashAlgorithm()
Specified by:
getHashAlgorithm in interface Config

getConfigType

public ConfigType getConfigType()
Specified by:
getConfigType in interface Config


Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.