Package com.couchbase.client.core.node
Class Node
java.lang.Object
com.couchbase.client.core.node.Node
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void> addService(ServiceType type, int port, Optional<String> bucket) static Nodecreate(CoreContext ctx, NodeIdentifier identifier) protected ServicecreateService(ServiceType serviceType, HostAndPort address, Optional<String> bucket) Helper method to create theServicebased on the service type provided.reactor.core.publisher.Mono<Void> Instruct thisNodeto disconnect.booleaninthashCode()booleanReturns the node identifier.reactor.core.publisher.Mono<Void> removeService(ServiceType type, Optional<String> bucket) send(R request) Sends the request into thisNode.sendIntoRetry(R request) Retries the request.booleanserviceEnabled(ServiceType type) If a givenServiceTypeis enabled on this node.Optional<reactor.core.publisher.Flux<ServiceState>> serviceState(ServiceType type, Optional<String> bucket) If present, returns a flux that allows to monitor the state changes of a specific service.state()Returns the current state of the stateful component.reactor.core.publisher.Flux<NodeState> states()Returns a stream of states for this component as they change.toString()
-
Constructor Details
-
Node
-
-
Method Details
-
create
-
disconnect
Instruct thisNodeto disconnect.This method is async and will return immediately. Use the other methods available to inspect the current state of the node, signaling potential successful disconnection attempts.
-
addService
public reactor.core.publisher.Mono<Void> addService(ServiceType type, int port, Optional<String> bucket) - Parameters:
type- the type of the service.port- the port of the service.bucket- the bucket name (if present).- Returns:
- a
Monothat completes once the service is added.
-
removeService
- Parameters:
type- the type of service.bucket- the bucket name if present.- Returns:
- a mono once completed.
-
states
Description copied from interface:StatefulReturns a stream of states for this component as they change. -
state
Description copied from interface:StatefulReturns the current state of the stateful component. -
serviceState
public Optional<reactor.core.publisher.Flux<ServiceState>> serviceState(ServiceType type, Optional<String> bucket) If present, returns a flux that allows to monitor the state changes of a specific service.- Parameters:
type- the type of service.bucket- the bucket, if present.- Returns:
- if found, a flux with the service states.
-
send
Sends the request into thisNode.Note that there is no guarantee that the request will actually dispatched, based on the state this node is in.
- Parameters:
request- the request to send.
-
sendIntoRetry
Retries the request.This is a separate method because in test it is overridden to do easy assertions.
- Parameters:
request- the request to retry.
-
identifier
Returns the node identifier. -
serviceEnabled
If a givenServiceTypeis enabled on this node.- Parameters:
type- the service type to check.- Returns:
- true if enabled, false otherwise.
-
hasServicesEnabled
public boolean hasServicesEnabled() -
createService
protected Service createService(ServiceType serviceType, HostAndPort address, Optional<String> bucket) Helper method to create theServicebased on the service type provided.- Parameters:
serviceType- the type of service to create.address- the host and port for that service.bucket- optionally the bucket name.- Returns:
- a created service, but not yet connected or anything.
-
diagnostics
-
internalDiagnostics
-
equals
-
hashCode
public int hashCode() -
toString
-