@Stability.Volatile public class Core extends Object implements 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.
Modifier and Type | Class and Description |
---|---|
static class |
Core.ResponseMetricIdentifier |
Modifier | Constructor and Description |
---|---|
protected |
Core(CoreEnvironment environment,
Authenticator authenticator,
ConnectionString connectionString) |
Modifier and Type | Method and Description |
---|---|
CoreBucketManagerOps |
bucketManager() |
void |
close() |
ClusterConfig |
clusterConfig()
This API provides access to the current config that is published throughout the core.
|
CoreSearchIndexManager |
clusterSearchIndexManager() |
CoreCollectionManager |
collectionManager(String bucketName) |
ConfigurationProvider |
configurationProvider()
Returns the attached configuration provider.
|
CoreContext |
context()
Returns the
CoreContext of this core instance. |
static Core |
create(CoreEnvironment environment,
Authenticator authenticator,
ConnectionString connectionString) |
static Core |
create(CoreEnvironment environment,
Authenticator authenticator,
Set<SeedNode> seedNodes)
Deprecated.
Please use
create(CoreEnvironment, Authenticator, ConnectionString) instead. |
protected Node |
createNode(NodeIdentifier identifier,
Optional<String> alternateAddress)
Create a
Node from the given identifier. |
Stream<EndpointDiagnostics> |
diagnostics() |
Mono<Void> |
ensureServiceAt(NodeIdentifier identifier,
ServiceType serviceType,
int port,
Optional<String> bucket,
Optional<String> alternateAddress)
This method can be used by a caller to make sure a certain service is enabled at the given
target node.
|
CoreEnvironment |
environment() |
CoreHttpClient |
httpClient(RequestTarget target)
Returns a client for issuing HTTP requests to servers in the cluster.
|
void |
initGlobalConfig()
Instructs the client to, if possible, load and initialize the global config.
|
Stream<InternalEndpointDiagnostics> |
internalDiagnostics() |
CoreKvBinaryOps |
kvBinaryOps(CoreKeyspace keyspace) |
CoreKvOps |
kvOps(CoreKeyspace keyspace) |
void |
openBucket(String name)
Attempts to open a bucket and fails the
Mono if there is a persistent error
as the reason. |
CoreQueryOps |
queryOps() |
ValueRecorder |
responseMetric(Request<?> request,
Throwable err) |
CoreSearchIndexManager |
scopeSearchIndexManager(CoreBucketAndScope scope) |
CoreSearchOps |
searchOps(CoreBucketAndScope scope) |
<R extends Response> |
send(Request<R> request)
Sends a command into the core layer and registers the request with the timeout timer.
|
<R extends Response> |
send(Request<R> request,
boolean registerForTimeout)
Sends a command into the core layer and allows to avoid timeout registration.
|
Optional<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.
|
Mono<Void> |
shutdown() |
Mono<Void> |
shutdown(Duration timeout)
Shuts down this core and all associated, owned resources.
|
CoreTransactionsCleanup |
transactionsCleanup() |
CoreTransactionsContext |
transactionsContext() |
CompletableFuture<Void> |
waitUntilReady(Set<ServiceType> serviceTypes,
Duration timeout,
ClusterState desiredState,
String bucketName) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asCore, checkConnectionStringScheme
protected Core(CoreEnvironment environment, Authenticator authenticator, ConnectionString connectionString)
@Deprecated public static Core create(CoreEnvironment environment, Authenticator authenticator, Set<SeedNode> seedNodes)
create(CoreEnvironment, Authenticator, ConnectionString)
instead.public static Core create(CoreEnvironment environment, Authenticator authenticator, ConnectionString connectionString)
create
in interface CoreCouchbaseOps
@Stability.Internal public ConfigurationProvider configurationProvider()
Internal API, use with care!
public <R extends Response> void send(Request<R> request)
request
- the request to dispatch.@Stability.Internal public <R extends Response> void send(Request<R> request, boolean registerForTimeout)
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.
request
- the request to dispatch.registerForTimeout
- if the request should be registered with a timeout.public CoreContext context()
CoreContext
of this core instance.@Stability.Internal public CoreHttpClient httpClient(RequestTarget target)
@Stability.Internal public Stream<EndpointDiagnostics> diagnostics()
@Stability.Internal public Stream<InternalEndpointDiagnostics> internalDiagnostics()
@Stability.Internal public Optional<Flux<ServiceState>> serviceState(NodeIdentifier nodeIdentifier, ServiceType type, Optional<String> bucket)
nodeIdentifier
- the node identifier for the node.type
- the type of service.bucket
- the bucket, if present.@Stability.Internal public void initGlobalConfig()
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.
@Stability.Internal public void openBucket(String name)
Mono
if there is a persistent error
as the reason.@Stability.Internal public ClusterConfig clusterConfig()
Note that this is internal API and might change at any time.
@Stability.Internal public Mono<Void> ensureServiceAt(NodeIdentifier identifier, ServiceType serviceType, int port, Optional<String> bucket, Optional<String> alternateAddress)
This is advanced, internal functionality and should only be used if the caller knows what they are doing.
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.alternateAddress
- if an alternate address is present, needs to be provided since it is passed down
to the node and its services.Mono
which completes once initiated.@Stability.Internal public ValueRecorder responseMetric(Request<?> request, @Nullable Throwable err)
protected Node createNode(NodeIdentifier identifier, Optional<String> alternateAddress)
Node
from the given identifier.
This method is here so it can be overridden in tests.
identifier
- the identifier for the node.alternateAddress
- the alternate address if present.@Stability.Internal public Mono<Void> shutdown()
@Stability.Internal public Mono<Void> shutdown(Duration timeout)
shutdown
in interface CoreCouchbaseOps
@Stability.Internal public CoreTransactionsCleanup transactionsCleanup()
@Stability.Internal public CoreTransactionsContext transactionsContext()
public void close()
close
in interface AutoCloseable
@Stability.Internal public CoreKvOps kvOps(CoreKeyspace keyspace)
kvOps
in interface CoreCouchbaseOps
@Stability.Internal public CoreQueryOps queryOps()
queryOps
in interface CoreCouchbaseOps
@Stability.Internal public CoreSearchOps searchOps(@Nullable CoreBucketAndScope scope)
searchOps
in interface CoreCouchbaseOps
@Stability.Internal public CoreKvBinaryOps kvBinaryOps(CoreKeyspace keyspace)
kvBinaryOps
in interface CoreCouchbaseOps
@Stability.Internal public CoreBucketManagerOps bucketManager()
bucketManager
in interface CoreCouchbaseOps
@Stability.Internal public CoreCollectionManager collectionManager(String bucketName)
collectionManager
in interface CoreCouchbaseOps
public CoreSearchIndexManager clusterSearchIndexManager()
clusterSearchIndexManager
in interface CoreCouchbaseOps
public CoreSearchIndexManager scopeSearchIndexManager(CoreBucketAndScope scope)
scopeSearchIndexManager
in interface CoreCouchbaseOps
public CoreEnvironment environment()
environment
in interface CoreCouchbaseOps
public CompletableFuture<Void> waitUntilReady(Set<ServiceType> serviceTypes, Duration timeout, ClusterState desiredState, @Nullable String bucketName)
waitUntilReady
in interface CoreCouchbaseOps
Copyright © 2024 Couchbase, Inc.. All rights reserved.