Package com.couchbase.client.core.config
Class DefaultCouchbaseBucketConfig
- java.lang.Object
-
- com.couchbase.client.core.config.AbstractBucketConfig
-
- com.couchbase.client.core.config.DefaultCouchbaseBucketConfig
-
- All Implemented Interfaces:
BucketConfig
,CouchbaseBucketConfig
public class DefaultCouchbaseBucketConfig extends AbstractBucketConfig implements CouchbaseBucketConfig
-
-
Field Summary
Fields Modifier and Type Field Description static int
PARTITION_NOT_EXISTENT
-
Constructor Summary
Constructors Constructor Description DefaultCouchbaseBucketConfig(long rev, String uuid, String name, String uri, String streamingUri, CouchbasePartitionInfo partitionInfo, List<NodeInfo> nodeInfos, List<PortInfo> portInfos, List<BucketCapabilities> bucketCapabilities, String origin)
Creates a newCouchbaseBucketConfig
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
ephemeral()
If this couchbase bucket is ephemeral.boolean
hasFastForwardMap()
Returns true if the config has a fast forward map that describes what the topology of the cluster will be after the current rebalance operation completes.boolean
hasPrimaryPartitionsOnNode(String hostname)
Checks if the given hostname has active primary partitions assigned to it.NodeInfo
nodeAtIndex(int nodeIndex)
Returns information for the node at the given index.short
nodeIndexForMaster(int partition, boolean useFastForward)
Returns the node index for the given partition index and master.short
nodeIndexForReplica(int partition, int replica, boolean useFastForward)
Returns the node index for the given partition index and the replica.int
numberOfPartitions()
Returns the total number of partitions.int
numberOfReplicas()
The number of configured replicas for this bucket.long
rev()
Revision number (optional) for that configuration.boolean
tainted()
Returns true if the config indicates the cluster is undergoing a transition (such as a rebalance operation).String
toString()
BucketType
type()
The bucket type.-
Methods inherited from class com.couchbase.client.core.config.AbstractBucketConfig
capabilities, locator, name, nodes, password, password, serviceEnabled, streamingUri, uri, useAlternateNetwork, useAlternateNetwork, username, username, uuid
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.couchbase.client.core.config.BucketConfig
capabilities, locator, name, nodes, password, password, serviceEnabled, streamingUri, uri, useAlternateNetwork, useAlternateNetwork, username, username, uuid
-
-
-
-
Field Detail
-
PARTITION_NOT_EXISTENT
public static final int PARTITION_NOT_EXISTENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultCouchbaseBucketConfig
public DefaultCouchbaseBucketConfig(long rev, String uuid, String name, String uri, String streamingUri, CouchbasePartitionInfo partitionInfo, List<NodeInfo> nodeInfos, List<PortInfo> portInfos, List<BucketCapabilities> bucketCapabilities, String origin)
Creates a newCouchbaseBucketConfig
.- Parameters:
rev
- the revision of the config.name
- the name of the bucket.uri
- the URI for this bucket.streamingUri
- the streaming URI for this bucket.partitionInfo
- partition info for this bucket.nodeInfos
- related node information.portInfos
- port info for the nodes, including services.
-
-
Method Detail
-
numberOfReplicas
public int numberOfReplicas()
Description copied from interface:CouchbaseBucketConfig
The number of configured replicas for this bucket.- Specified by:
numberOfReplicas
in interfaceCouchbaseBucketConfig
- Returns:
- number of replicas.
-
tainted
public boolean tainted()
Description copied from interface:BucketConfig
Returns true if the config indicates the cluster is undergoing a transition (such as a rebalance operation).- Specified by:
tainted
in interfaceBucketConfig
- Returns:
- true if a transition is in progress.
-
hasPrimaryPartitionsOnNode
public boolean hasPrimaryPartitionsOnNode(String hostname)
Description copied from interface:CouchbaseBucketConfig
Checks if the given hostname has active primary partitions assigned to it.- Specified by:
hasPrimaryPartitionsOnNode
in interfaceCouchbaseBucketConfig
- Parameters:
hostname
- the hostname of the node to check against.- Returns:
- true if it has, false otherwise.
-
nodeIndexForMaster
public short nodeIndexForMaster(int partition, boolean useFastForward)
Description copied from interface:CouchbaseBucketConfig
Returns the node index for the given partition index and master.- Specified by:
nodeIndexForMaster
in interfaceCouchbaseBucketConfig
- Parameters:
partition
- the index of the partition.useFastForward
- if the fast forward config should be used.- Returns:
- the index of the node.
-
nodeIndexForReplica
public short nodeIndexForReplica(int partition, int replica, boolean useFastForward)
Description copied from interface:CouchbaseBucketConfig
Returns the node index for the given partition index and the replica.- Specified by:
nodeIndexForReplica
in interfaceCouchbaseBucketConfig
- Parameters:
partition
- the index of the partition.replica
- the replica number.useFastForward
- if the fast forward config should be used.- Returns:
- the index of the node.
-
numberOfPartitions
public int numberOfPartitions()
Description copied from interface:CouchbaseBucketConfig
Returns the total number of partitions.- Specified by:
numberOfPartitions
in interfaceCouchbaseBucketConfig
- Returns:
- the number of partitions.
-
nodeAtIndex
public NodeInfo nodeAtIndex(int nodeIndex)
Description copied from interface:CouchbaseBucketConfig
Returns information for the node at the given index.- Specified by:
nodeAtIndex
in interfaceCouchbaseBucketConfig
- Parameters:
nodeIndex
- the index of the node.- Returns:
- the information of the node at this index.
-
rev
public long rev()
Description copied from interface:BucketConfig
Revision number (optional) for that configuration.- Specified by:
rev
in interfaceBucketConfig
- Returns:
- the rev number, might be 0.
-
type
public BucketType type()
Description copied from interface:BucketConfig
The bucket type.- Specified by:
type
in interfaceBucketConfig
- Returns:
- the bucket type.
-
hasFastForwardMap
public boolean hasFastForwardMap()
Description copied from interface:BucketConfig
Returns true if the config has a fast forward map that describes what the topology of the cluster will be after the current rebalance operation completes.- Specified by:
hasFastForwardMap
in interfaceBucketConfig
- Returns:
- true if it does, false otherwise.
-
ephemeral
public boolean ephemeral()
Description copied from interface:CouchbaseBucketConfig
If this couchbase bucket is ephemeral.- Specified by:
ephemeral
in interfaceCouchbaseBucketConfig
- Returns:
- true if it is, false otherwise.
-
-