Class Core
- All Implemented Interfaces:
CoreCouchbaseOps,AutoCloseable
This class has been around behind a facade in the 1.x days, but here it is just a plain simple class that can be instantiated and is used across the upper language bindings.
- Since:
- 2.0.0
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCore(CoreEnvironment environment, Authenticator authenticator, ConnectionString connectionString) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This API provides access to the current config that is published throughout the core.collectionManager(String bucketName) Returns the attached configuration provider.context()Returns theCoreContextof this core instance.static Corecreate(CoreEnvironment environment, Authenticator authenticator, ConnectionString connectionString) static Corecreate(CoreEnvironment environment, Authenticator authenticator, Set<SeedNode> seedNodes) Deprecated.protected NodecreateNode(NodeIdentifier identifier) Create aNodefrom the given identifier.reactor.core.publisher.Mono<Void> ensureServiceAt(NodeIdentifier identifier, ServiceType serviceType, int port, Optional<String> bucket) This method can be used by a caller to make sure a certain service is enabled at the given target node.httpClient(RequestTarget target) Returns a client for issuing HTTP requests to servers in the cluster.voidInstructs the client to, if possible, load and initialize the global config.kvBinaryOps(CoreKeyspace keyspace) kvOps(CoreKeyspace keyspace) voidopenBucket(String name) Attempts to open a bucket and fails theMonoif there is a persistent error as the reason.queryOps()responseMetric(Request<?> request, Throwable err) searchOps(CoreBucketAndScope scope) <R extends Response>
voidSends a command into the core layer and registers the request with the timeout timer.<R extends Response>
voidSends a command into the core layer and allows to avoid timeout registration.Optional<reactor.core.publisher.Flux<ServiceState>> serviceState(NodeIdentifier nodeIdentifier, ServiceType type, Optional<String> bucket) If present, returns a flux that allows to monitor the state changes of a specific service.reactor.core.publisher.Mono<Void> shutdown()reactor.core.publisher.Mono<Void> Shuts down this core and all associated, owned resources.reactor.core.publisher.Mono<ClusterTopology> waitForClusterTopology(Duration timeout) waitUntilReady(Set<ServiceType> serviceTypes, Duration timeout, ClusterState desiredState, String bucketName) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.couchbase.client.core.api.CoreCouchbaseOps
asCore
-
Constructor Details
-
Core
protected Core(CoreEnvironment environment, Authenticator authenticator, ConnectionString connectionString)
-
-
Method Details
-
create
@Deprecated public static Core create(CoreEnvironment environment, Authenticator authenticator, Set<SeedNode> seedNodes) Deprecated.Please usecreate(CoreEnvironment, Authenticator, ConnectionString)instead. -
create
public static Core create(CoreEnvironment environment, Authenticator authenticator, ConnectionString connectionString) -
configurationProvider
Returns the attached configuration provider.Internal API, use with care!
-
send
Sends a command into the core layer and registers the request with the timeout timer.- Parameters:
request- the request to dispatch.
-
send
Sends a command into the core layer and allows to avoid timeout registration.Usually you want to use
send(Request)instead, this method should only be used during retry situations where the request has already been registered with a timeout timer before.- Parameters:
request- the request to dispatch.registerForTimeout- if the request should be registered with a timeout.
-
context
Returns theCoreContextof this core instance. -
httpClient
Returns a client for issuing HTTP requests to servers in the cluster. -
diagnostics
-
internalDiagnostics
-
serviceState
@Internal public Optional<reactor.core.publisher.Flux<ServiceState>> serviceState(NodeIdentifier nodeIdentifier, ServiceType type, Optional<String> bucket) If present, returns a flux that allows to monitor the state changes of a specific service.- Parameters:
nodeIdentifier- the node identifier for the node.type- the type of service.bucket- the bucket, if present.- Returns:
- if found, a flux with the service states.
-
initGlobalConfig
Instructs the client to, if possible, load and initialize the global config.Since global configs are an "optional" feature depending on the cluster version, if an error happens this method will not fail. Rather it will log the exception (with some logic dependent on the type of error) and will allow the higher level components to move on where possible.
-
openBucket
Attempts to open a bucket and fails theMonoif there is a persistent error as the reason. -
clusterConfig
This API provides access to the current config that is published throughout the core.Note that this is internal API and might change at any time.
-
waitForClusterTopology
@Internal public reactor.core.publisher.Mono<ClusterTopology> waitForClusterTopology(Duration timeout) -
ensureServiceAt
@Internal public reactor.core.publisher.Mono<Void> ensureServiceAt(NodeIdentifier identifier, ServiceType serviceType, int port, Optional<String> bucket) This method can be used by a caller to make sure a certain service is enabled at the given target node.This is advanced, internal functionality and should only be used if the caller knows what they are doing.
- Parameters:
identifier- the node to check.serviceType- the service type to enable if not enabled already.port- the port where the service is listening on.bucket- if the service is bound to a bucket, it needs to be provided.- Returns:
- a
Monowhich completes once initiated.
-
responseMetric
-
createNode
Create aNodefrom the given identifier.This method is here so it can be overridden in tests.
- Parameters:
identifier- the identifier for the node.- Returns:
- the created node instance.
-
shutdown
-
shutdown
Shuts down this core and all associated, owned resources.- Specified by:
shutdownin interfaceCoreCouchbaseOps
-
transactionsCleanup
-
transactionsContext
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
kvOps
- Specified by:
kvOpsin interfaceCoreCouchbaseOps
-
queryOps
- Specified by:
queryOpsin interfaceCoreCouchbaseOps
-
searchOps
- Specified by:
searchOpsin interfaceCoreCouchbaseOps
-
kvBinaryOps
- Specified by:
kvBinaryOpsin interfaceCoreCouchbaseOps
-
bucketManager
- Specified by:
bucketManagerin interfaceCoreCouchbaseOps
-
collectionManager
- Specified by:
collectionManagerin interfaceCoreCouchbaseOps
-
clusterSearchIndexManager
- Specified by:
clusterSearchIndexManagerin interfaceCoreCouchbaseOps
-
scopeSearchIndexManager
- Specified by:
scopeSearchIndexManagerin interfaceCoreCouchbaseOps
-
environment
- Specified by:
environmentin interfaceCoreCouchbaseOps
-
coreResources
- Specified by:
coreResourcesin interfaceCoreCouchbaseOps
-
appTelemetryCollector
-
waitUntilReady
public CompletableFuture<Void> waitUntilReady(Set<ServiceType> serviceTypes, Duration timeout, ClusterState desiredState, @Nullable String bucketName) - Specified by:
waitUntilReadyin interfaceCoreCouchbaseOps
-
create(CoreEnvironment, Authenticator, ConnectionString)instead.