Package com.couchbase.client.java
Class Bucket
java.lang.Object
com.couchbase.client.java.Bucket
public class Bucket extends Object
Provides access to a Couchbase bucket in a blocking fashion.
-
Method Summary
Modifier and Type Method Description AsyncBucket
async()
Provides access to the underlyingAsyncBucket
.Collection
collection(String collectionName)
Opens the collection with the given name for thisBucket
.CollectionManager
collections()
Core
core()
Provides access to the underlyingCore
.Collection
defaultCollection()
Opens the default collection for thisBucket
.Scope
defaultScope()
Opens the defaultScope
.ClusterEnvironment
environment()
Returns the attachedClusterEnvironment
.String
name()
Returns the name of theBucket
.PingResult
ping()
Performs application-level ping requests against services in the couchbase cluster.PingResult
ping(PingOptions options)
Performs application-level ping requests with custom options against services in the couchbase cluster.ReactiveBucket
reactive()
Provides access to the relatedReactiveBucket
.Scope
scope(String name)
Opens theScope
with the given name.ViewIndexManager
viewIndexes()
ViewResult
viewQuery(String designDoc, String viewName)
Queries a view on the bucket.ViewResult
viewQuery(String designDoc, String viewName, ViewOptions options)
Queries a view on the bucket with custom options.void
waitUntilReady(Duration timeout)
Waits until the desiredClusterState
is reached.void
waitUntilReady(Duration timeout, WaitUntilReadyOptions options)
Waits until the desiredClusterState
is reached.
-
Method Details
-
async
Provides access to the underlyingAsyncBucket
. -
reactive
Provides access to the relatedReactiveBucket
. -
name
Returns the name of theBucket
. -
environment
Returns the attachedClusterEnvironment
. -
collections
-
viewIndexes
-
core
Provides access to the underlyingCore
.This is advanced API, use with care!
-
scope
Opens theScope
with the given name.- Parameters:
name
- the name of the scope.- Returns:
- the
Scope
once opened.
-
defaultScope
Opens the defaultScope
.- Returns:
- the
Scope
once opened.
-
defaultCollection
Opens the default collection for thisBucket
.- Returns:
- the
Collection
once opened.
-
collection
Opens the collection with the given name for thisBucket
.- Returns:
- the
Collection
once opened.
-
viewQuery
Queries a view on the bucket.- Parameters:
designDoc
- the name of the design document in which the view resides.viewName
- the name of the view to query.- Returns:
- a
ViewResult
once completed. - Throws:
ViewNotFoundException
- if the view or design document is not found on the server.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
viewQuery
Queries a view on the bucket with custom options.- Parameters:
designDoc
- the name of the design document in which the view resides.viewName
- the name of the view to query.options
- allows to customize view options.- Returns:
- a
ViewResult
once completed. - Throws:
ViewNotFoundException
- if the view or design document is not found on the server.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
ping
Performs application-level ping requests against services in the couchbase cluster.- Returns:
- the
PingResult
once complete.
-
ping
Performs application-level ping requests with custom options against services in the couchbase cluster.- Returns:
- the
PingResult
once complete.
-
waitUntilReady
Waits until the desiredClusterState
is 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.
-
waitUntilReady
Waits until the desiredClusterState
is 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.
-