Interface ConfigurationProvider

All Known Implementing Classes:
DefaultConfigurationProvider

@Internal public interface ConfigurationProvider
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 Details

  • 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 current ClusterConfig.
      Returns:
      the current cluster configuration.
    • seedNodes

      Flux<Set<SeedNode>> 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

      Mono<Void> openBucket(String name)
      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

      Mono<Void> closeBucket(String name, boolean pushConfig)
      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

      Mono<Void> shutdown()
      Shuts down the configuration provider and all its associated resources and timers.
      Returns:
      the mono completes once shut down properly.
    • proposeBucketConfig

      void proposeBucketConfig(ProposedBucketConfigContext ctx)
      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

      void proposeGlobalConfig(ProposedGlobalConfigContext ctx)
      Allows to propose a global config to the provider from an external context.
      Parameters:
      ctx - the context with the global config.
    • loadAndRefreshGlobalConfig

      Mono<Void> loadAndRefreshGlobalConfig()
      Instructs the provider to try and load the global config, and then manage it.
    • collectionMap

      CollectionMap collectionMap()
      Returns the attached collection map.
    • refreshCollectionId

      void refreshCollectionId(CollectionIdentifier identifier)
      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 gives InvalidStateWatchdog 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

      boolean collectionRefreshInProgress(CollectionIdentifier identifier)
      Returns true if a collection refresh is in progress for the given identifier.
      Parameters:
      identifier - the collection identifier to check.
    • signalConfigRefreshFailed

      void signalConfigRefreshFailed(ConfigRefreshFailure failure)
      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

      Flux<Long> configChangeNotifications()
      Returns a feed that emits -1L whenever someone calls signalConfigChanged().