Package com.couchbase.client.core.config
Class DefaultConfigurationProvider
- java.lang.Object
-
- com.couchbase.client.core.config.DefaultConfigurationProvider
-
- All Implemented Interfaces:
ConfigurationProvider
public class DefaultConfigurationProvider extends Object implements ConfigurationProvider
The standardConfigurationProvider
that is used by default.This provider has been around since the 1.x days, but it has been revamped and reworked for the 2.x breakage - the overall functionality remains very similar though.
- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description DefaultConfigurationProvider(Core core)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<Void>
closeBucket(String name)
Initiates the bucket closing process.CollectionMap
collectionMap()
Returns the attached collection map.ClusterConfig
config()
Returns the currentClusterConfig
.Flux<ClusterConfig>
configs()
This is a hot stream which when attached will return the current config as well as all subsequent ones.Mono<Void>
openBucket(String name)
Initiates the bucket opening process.void
proposeBucketConfig(ProposedBucketConfigContext ctx)
Allows to propose a bucket config to the provider from an external context.Mono<Void>
refreshCollectionMap(String bucket, boolean force)
Helper method to refresh the collection map for the given bucket.Mono<Void>
shutdown()
Shuts down the configuration provider and all its associated resources and timers.
-
-
-
Constructor Detail
-
DefaultConfigurationProvider
public DefaultConfigurationProvider(Core core)
-
-
Method Detail
-
collectionMap
public CollectionMap collectionMap()
Description copied from interface:ConfigurationProvider
Returns the attached collection map.- Specified by:
collectionMap
in interfaceConfigurationProvider
-
configs
public Flux<ClusterConfig> configs()
Description copied from interface:ConfigurationProvider
This is a hot stream which when attached will return the current config as well as all subsequent ones.- Specified by:
configs
in interfaceConfigurationProvider
- Returns:
- a flux of new configurations as they arrive.
-
config
public ClusterConfig config()
Description copied from interface:ConfigurationProvider
Returns the currentClusterConfig
.- Specified by:
config
in interfaceConfigurationProvider
- Returns:
- the current cluster configuration.
-
openBucket
public Mono<Void> openBucket(String name)
Description copied from interface:ConfigurationProvider
Initiates the bucket opening process.Note that when this mono completes, it does not mean that the process is completely finished yet, just that it has been initiated and no hard error has been found at the time.
- Specified by:
openBucket
in interfaceConfigurationProvider
- Parameters:
name
- the name of the bucket to open.- Returns:
- a Mono that completes once the bucket has been logically opened.
-
proposeBucketConfig
public void proposeBucketConfig(ProposedBucketConfigContext ctx)
Description copied from interface:ConfigurationProvider
Allows to propose a bucket config to the provider from an external context.This method is usually only called when a "not my vbucket" response is received and the corresponding config is extracted. Do not call this method with arbitrary configs.
- Specified by:
proposeBucketConfig
in interfaceConfigurationProvider
- Parameters:
ctx
- the bucket config and surrounding context.
-
closeBucket
public Mono<Void> closeBucket(String name)
Description copied from interface:ConfigurationProvider
Initiates the bucket closing process.- Specified by:
closeBucket
in interfaceConfigurationProvider
- Parameters:
name
- the name of the bucket.- Returns:
- a Mono that completes once the bucket has been logically closed.
-
shutdown
public Mono<Void> shutdown()
Description copied from interface:ConfigurationProvider
Shuts down the configuration provider and all its associated resources and timers.- Specified by:
shutdown
in interfaceConfigurationProvider
- Returns:
- the mono completes once shut down properly.
-
refreshCollectionMap
public Mono<Void> refreshCollectionMap(String bucket, boolean force)
Description copied from interface:ConfigurationProvider
Helper method to refresh the collection map for the given bucket.- Specified by:
refreshCollectionMap
in interfaceConfigurationProvider
- Parameters:
bucket
- the name of the bucket.force
- if set, the provider must fetch a new one. otherwise it will only fetch one for the bucket if not already present.- Returns:
- once refreshed completes the mono (or fails if error).
-
-