public class RequestHandler extends Object implements com.lmax.disruptor.EventHandler<RequestEvent>
RequestHandler
is responsible for adding and removing Node
s as well as dispatching
Service
management operations. Its main purpose though is to receive incoming CouchbaseRequest
s
and dispatch them to the appropriate Node
s.Constructor and Description |
---|
RequestHandler(CoreContext ctx,
rx.Observable<ClusterConfig> configObservable)
Create a new
RequestHandler . |
Modifier and Type | Method and Description |
---|---|
rx.Observable<LifecycleState> |
addNode(NetworkAddress hostname,
NetworkAddress alternate)
Add a
Node identified by its hostname. |
rx.Observable<Service> |
addService(AddServiceRequest request)
Add the service to the node.
|
protected void |
checkFeaturesForRequest(CouchbaseRequest request,
BucketConfig config)
Checks, for a sub-set of
CouchbaseRequest , if the current environment has
the necessary feature activated. |
rx.Observable<DiagnosticsResponse> |
diagnostics(String id)
Performs the logistics of collecting and assembling the individual health check information
on a per-service basis.
|
protected Locator |
locator(CouchbaseRequest request)
Helper method to detect the correct locator for the given request type.
|
Node |
nodeBy(NetworkAddress hostname)
Returns the node by its hostname.
|
void |
onEvent(RequestEvent event,
long sequence,
boolean endOfBatch) |
rx.Observable<ClusterConfig> |
reconfigure(ClusterConfig config)
Helper method which grabs the current configuration and checks if the node setup is out of sync.
|
rx.Observable<LifecycleState> |
removeNode(NetworkAddress hostname)
Remove a
Node identified by its hostname. |
rx.Observable<Service> |
removeService(RemoveServiceRequest request)
Remove a service from a node.
|
public RequestHandler(CoreContext ctx, rx.Observable<ClusterConfig> configObservable)
RequestHandler
.public void onEvent(RequestEvent event, long sequence, boolean endOfBatch) throws Exception
onEvent
in interface com.lmax.disruptor.EventHandler<RequestEvent>
Exception
protected void checkFeaturesForRequest(CouchbaseRequest request, BucketConfig config)
CouchbaseRequest
, if the current environment has
the necessary feature activated. If not, throws an ServiceNotAvailableException
.request
- the request to check.ServiceNotAvailableException
- if the request type needs a particular feature which isn't activated.public rx.Observable<LifecycleState> addNode(NetworkAddress hostname, NetworkAddress alternate)
Node
identified by its hostname.hostname
- the hostname of the node.LifecycleState.CONNECTED
).public rx.Observable<LifecycleState> removeNode(NetworkAddress hostname)
Node
identified by its hostname.hostname
- the hostname of the node.LifecycleState.DISCONNECTED
).public rx.Observable<Service> addService(AddServiceRequest request)
request
- the request which contains infos about the service and node to add.public rx.Observable<Service> removeService(RemoveServiceRequest request)
request
- the request which contains infos about the service and node to remove.public Node nodeBy(NetworkAddress hostname)
hostname
- the hostname of the node.protected Locator locator(CouchbaseRequest request)
public rx.Observable<DiagnosticsResponse> diagnostics(String id)
public rx.Observable<ClusterConfig> reconfigure(ClusterConfig config)
Copyright © 2018 Couchbase, Inc.. All rights reserved.