Package com.couchbase.client.core.config
Interface ConfigurationProvider
- All Known Implementing Classes:
DefaultConfigurationProvider
The
ConfigurationProvider
is responsible for grabbing, converting and managing
bucket and cluster configurations.
This interface has been around since the 1.0 days, but it has been adapted to fit the 2.x types and process.
- Since:
- 1.0.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
The value emitted by theconfigChangeNotifications()
feed. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if a bucket config load attempt is in progress.closeBucket
(String name, boolean pushConfig) Initiates the bucket closing process.Returns the attached collection map.boolean
Returns true while a collection refresh is in progress at all.boolean
collectionRefreshInProgress
(CollectionIdentifier identifier) Returns true if a collection refresh is in progress for the given identifier.config()
Returns the currentClusterConfig
.Returns a feed that emits -1L whenever someone callssignalConfigChanged()
.configs()
This is a hot stream which when attached will return the current config as well as all subsequent ones.boolean
Returns true if an initial global config load attempt is in progress.Instructs the provider to try and load the global config, and then manage it.openBucket
(String name) Initiates the bucket opening process.void
Allows to propose a bucket config to the provider from an external context.void
Allows to propose a global config to the provider from an external context.void
refreshCollectionId
(CollectionIdentifier identifier) Helper method to refresh the collection map for the given collection.default void
Shouldn't be necessary, but givesInvalidStateWatchdog
something to do.Returns a stream of seed node sets sourced from the server's global config or bucket config.shutdown()
Shuts down the configuration provider and all its associated resources and timers.void
Signals to the config provider that the server sent a notification that the cluster topology or bucket config changed.void
Signals to the config provider that certain types of config refreshes failed and action might need to be taken.
-
Field Details
-
TRIGGERED_BY_CONFIG_CHANGE_NOTIFICATION
static final long TRIGGERED_BY_CONFIG_CHANGE_NOTIFICATIONThe value emitted by theconfigChangeNotifications()
feed.- See Also:
-
-
Method Details
-
configs
Flux<ClusterConfig> configs()This is a hot stream which when attached will return the current config as well as all subsequent ones.- Returns:
- a flux of new configurations as they arrive.
-
config
ClusterConfig config()Returns the currentClusterConfig
.- Returns:
- the current cluster configuration.
-
seedNodes
Returns a stream of seed node sets sourced from the server's global config or bucket config.Only nodes running the KV service are present in the set.
This is a hot stream which when attached will return the current set of seed nodes as well as all subsequent sets. The returned Flux does not emit any items until the client has received at least one config from the server.
- Returns:
- a flux of new sets of seed nodes as they arrive.
-
openBucket
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.
- Parameters:
name
- the name of the bucket to open.- Returns:
- a Mono that completes once the bucket has been logically opened.
-
closeBucket
Initiates the bucket closing process.- Parameters:
name
- the name of the bucket.pushConfig
- whether this should result in a config being pushed. Not needed during e.g. shutdown.- Returns:
- a Mono that completes once the bucket has been logically closed.
-
shutdown
Shuts down the configuration provider and all its associated resources and timers.- Returns:
- the mono completes once shut down properly.
-
proposeBucketConfig
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.
- Parameters:
ctx
- the bucket config and surrounding context.
-
proposeGlobalConfig
Allows to propose a global config to the provider from an external context.- Parameters:
ctx
- the context with the global config.
-
loadAndRefreshGlobalConfig
Instructs the provider to try and load the global config, and then manage it. -
collectionMap
CollectionMap collectionMap()Returns the attached collection map. -
refreshCollectionId
Helper method to refresh the collection map for the given collection. Returns after refreshed completes the mono (or fails if error).- Parameters:
identifier
- the identifier to refresh.
-
republishCurrentConfig
default void republishCurrentConfig()Shouldn't be necessary, but givesInvalidStateWatchdog
something to do. -
globalConfigLoadInProgress
boolean globalConfigLoadInProgress()Returns true if an initial global config load attempt is in progress.- Returns:
- true if it is in progress, false if not (done or failed).
-
bucketConfigLoadInProgress
boolean bucketConfigLoadInProgress()Returns true if a bucket config load attempt is in progress.- Returns:
- true if in progress, false if not.
-
collectionRefreshInProgress
boolean collectionRefreshInProgress()Returns true while a collection refresh is in progress at all. -
collectionRefreshInProgress
Returns true if a collection refresh is in progress for the given identifier.- Parameters:
identifier
- the collection identifier to check.
-
signalConfigRefreshFailed
Signals to the config provider that certain types of config refreshes failed and action might need to be taken.- Parameters:
failure
- the type of config refresh failure.
-
signalConfigChanged
void signalConfigChanged()Signals to the config provider that the server sent a notification that the cluster topology or bucket config changed. -
configChangeNotifications
Returns a feed that emits -1L whenever someone callssignalConfigChanged()
.
-