public class CouchbaseNode extends AbstractStateMachine<LifecycleState> implements Node
The general implementation of a Node
.
A Node
manages one or more Service
s. When a node gets connected, all currently configured Service
s are connected. Those can and will also be added and removed on demand. On disconnect, all services will be shut down asynchronously and then the node is determined to be shutdown.
A Node
s states is composed exclusively of the underlying Service
states.
Constructor and Description |
---|
CouchbaseNode(NetworkAddress hostname,
CoreEnvironment environment,
com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer) |
Modifier and Type | Method and Description |
---|---|
rx.Observable<Service> |
addService(AddServiceRequest request) |
rx.Observable<LifecycleState> |
connect()
Connects all currently enabled
Service s. |
rx.Observable<LifecycleState> |
disconnect()
Disconnects all currently enabled
Service s. |
boolean |
equals(Object o) |
int |
hashCode() |
rx.Observable<EndpointHealth> |
healthCheck()
Returns endpoint health information for all endpoints this node is currently associated with.
|
NetworkAddress |
hostname()
Returns the configured hostname for the
Node . |
protected static String |
logIdent(NetworkAddress hostname)
Simple log helper to give logs a common prefix.
|
rx.Observable<Service> |
removeService(RemoveServiceRequest request) |
void |
send(CouchbaseRequest request)
Sends a
CouchbaseRequest into the node and eventually returns a CouchbaseResponse . |
boolean |
serviceEnabled(ServiceType type)
True if the given
ServiceType is currently enabled on this node, false otherwise. |
String |
toString() |
hasSubscribers, isState, state, states, transitionState
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
hasSubscribers, isState, state, states
public CouchbaseNode(NetworkAddress hostname, CoreEnvironment environment, com.lmax.disruptor.RingBuffer<ResponseEvent> responseBuffer)
public void send(CouchbaseRequest request)
Node
Sends a CouchbaseRequest
into the node and eventually returns a CouchbaseResponse
.
The CouchbaseResponse
is not returned directly, but is wrapped into a Observable
.
public NetworkAddress hostname()
Node
Returns the configured hostname for the Node
.
public rx.Observable<LifecycleState> connect()
Node
Connects all currently enabled Service
s.
public rx.Observable<LifecycleState> disconnect()
Node
Disconnects all currently enabled Service
s.
disconnect
in interface Node
Node
after the disconnect process for all enabled Service
s.public rx.Observable<Service> addService(AddServiceRequest request)
addService
in interface Node
public rx.Observable<Service> removeService(RemoveServiceRequest request)
removeService
in interface Node
public rx.Observable<EndpointHealth> healthCheck()
Node
Returns endpoint health information for all endpoints this node is currently associated with.
healthCheck
in interface Node
protected static String logIdent(NetworkAddress hostname)
Simple log helper to give logs a common prefix.
hostname
- the address.public boolean serviceEnabled(ServiceType type)
Node
True if the given ServiceType
is currently enabled on this node, false otherwise.
serviceEnabled
in interface Node
Copyright © 2017 Couchbase, Inc.. All rights reserved.