- All Implemented Interfaces:
public abstract class BaseBucketLoader extends Object implements BucketLoaderThe
BaseBucketLoadercontains all common functionality needed for the actual loader implementations.
This abstract parent class basically ensures that the service and node needed to possibly fetch a configuration are enabled. It might still fail in progress for whatever reason, but that's why there are fallbacks in place (in the form of other loaders).
Once a config is loaded, the base loader is also responsible for turning the string-based config into a proper config that can be distributed throughout the system.
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description
core()Returns the attached
Coreto be used by implementations.
protected abstract Mono<byte>
discoverConfig(NodeIdentifier seed, String bucket)To be implemented by the actual child, performs the actual fetching of a config.
load(NodeIdentifier seed, int port, String bucket, Optional<String> alternateAddress)Performs the config loading through multiple steps.
protected abstract Mono<byte> discoverConfig(NodeIdentifier seed, String bucket)To be implemented by the actual child, performs the actual fetching of a config.
seed- the node from where to fetch it.
bucket- the name of the bucket to fetch from.
- the encoded json version of the config if complete, an error otherwise.
public Mono<ProposedBucketConfigContext> load(NodeIdentifier seed, int port, String bucket, Optional<String> alternateAddress)Performs the config loading through multiple steps.
First, it makes sure that the service is enabled so that the following child implementation can run its commands to actually fetch the config. Once the config is successfully loaded, it then turns it first into a proper string and then sends it to the bucket config parser to turn it into an actual config.
Two things to note: $HOST is a special syntax by the cluster manager which the client needs to replace with the hostname where it loaded the config from. Also, at the end we are wrapping all non-config exceptions into config exceptions so that the upper level only needs to handle one specific exception type.
At this point, we are passing an
Optional.empty()for alternate addresses when the service is created, since we do not have a config to check against at this point. The config provider will take care of this at a later point in time, before the rest of the bootstrap happens.