Class AsyncBucket
- java.lang.Object
-
- com.couchbase.client.java.AsyncBucket
-
public class AsyncBucket extends Object
Provides access to a Couchbase bucket in an async fashion.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncCollectioncollection(String collectionName)Provides access to the collection with the given name for thisAsyncBucketusing the default scope.AsyncCollectionManagercollections()Corecore()Provides access to the underlyingCore.AsyncCollectiondefaultCollection()Opens the default collection for thisAsyncBucketusing the default scope.AsyncScopedefaultScope()Opens the defaultAsyncScope.ClusterEnvironmentenvironment()Returns the attachedClusterEnvironment.Stringname()Returns the name of theAsyncBucket.CompletableFuture<PingResult>ping()Performs application-level ping requests against services in the couchbase cluster.CompletableFuture<PingResult>ping(PingOptions options)Performs application-level ping requests with custom options against services in the couchbase cluster.AsyncScopescope(String name)Opens theAsyncScopewith the given name.AsyncViewIndexManagerviewIndexes()CompletableFuture<ViewResult>viewQuery(String designDoc, String viewName)CompletableFuture<ViewResult>viewQuery(String designDoc, String viewName, ViewOptions options)CompletableFuture<Void>waitUntilReady(Duration timeout)Waits until the desiredClusterStateis reached.CompletableFuture<Void>waitUntilReady(Duration timeout, WaitUntilReadyOptions options)Waits until the desiredClusterStateis reached.
-
-
-
Method Detail
-
name
public String name()
Returns the name of theAsyncBucket.
-
environment
public ClusterEnvironment environment()
Returns the attachedClusterEnvironment.
-
core
@Volatile public Core core()
Provides access to the underlyingCore.This is advanced API, use with care!
-
collections
public AsyncCollectionManager collections()
-
viewIndexes
public AsyncViewIndexManager viewIndexes()
-
scope
public AsyncScope scope(String name)
Opens theAsyncScopewith the given name.- Parameters:
name- the name of the scope.- Returns:
- the
AsyncScopeonce opened.
-
defaultScope
public AsyncScope defaultScope()
Opens the defaultAsyncScope.- Returns:
- the
AsyncScopeonce opened.
-
defaultCollection
public AsyncCollection defaultCollection()
Opens the default collection for thisAsyncBucketusing the default scope.This method does not block and the client will try to establish all needed resources in the background. If you need to eagerly await until all resources are established before performing an operation, use the
waitUntilReady(Duration)method on theAsyncBucket.- Returns:
- the opened default
AsyncCollection.
-
collection
public AsyncCollection collection(String collectionName)
Provides access to the collection with the given name for thisAsyncBucketusing the default scope.This method does not block and the client will try to establish all needed resources in the background. If you need to eagerly await until all resources are established before performing an operation, use the
waitUntilReady(Duration)method on theAsyncBucket.- Returns:
- the opened named
AsyncCollection.
-
viewQuery
public CompletableFuture<ViewResult> viewQuery(String designDoc, String viewName)
-
viewQuery
public CompletableFuture<ViewResult> viewQuery(String designDoc, String viewName, ViewOptions options)
-
ping
public CompletableFuture<PingResult> ping()
Performs application-level ping requests against services in the couchbase cluster.- Returns:
- the
PingResultonce complete.
-
ping
public CompletableFuture<PingResult> ping(PingOptions options)
Performs application-level ping requests with custom options against services in the couchbase cluster.- Returns:
- the
PingResultonce complete.
-
waitUntilReady
public CompletableFuture<Void> waitUntilReady(Duration timeout)
Waits until the desiredClusterStateis reached.This method will wait until either the cluster state is "online", or the timeout is reached. Since the SDK is bootstrapping lazily, this method allows to eagerly check during bootstrap if all of the services are online and usable before moving on.
- Parameters:
timeout- the maximum time to wait until readiness.- Returns:
- a completable future that completes either once ready or timeout.
-
waitUntilReady
public CompletableFuture<Void> waitUntilReady(Duration timeout, WaitUntilReadyOptions options)
Waits until the desiredClusterStateis reached.This method will wait until either the cluster state is "online" by default, or the timeout is reached. Since the SDK is bootstrapping lazily, this method allows to eagerly check during bootstrap if all of the services are online and usable before moving on. You can tune the properties through
WaitUntilReadyOptions.- Parameters:
timeout- the maximum time to wait until readiness.options- the options to customize the readiness waiting.- Returns:
- a completable future that completes either once ready or timeout.
-
-