Package com.couchbase.client.java.bucket
Interface BucketManager
-
- All Known Implementing Classes:
DefaultBucketManager
@Committed @Public public interface BucketManager
Provides management capabilities for aBucket
. Operations provided on theBucketManager
can be used to perform administrative tasks which require bucket-level credentials like managingDesignDocument
s or flushing aBucket
. Access to the underlyingAsyncBucketManager
is provided through theasync()
method.- Since:
- 2.0
- Author:
- Michael Nitschinger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AsyncBucketManager
async()
Returns the underlyingAsyncBucketManager
for asynchronous execution.List<String>
buildN1qlDeferredIndexes()
Instruct the query engine to trigger the build of indexes that have been deferred, within the default management timeout.List<String>
buildN1qlDeferredIndexes(long timeout, TimeUnit timeUnit)
Instruct the query engine to trigger the build of indexes that have been deferred, within a custom timeout.boolean
createN1qlIndex(String indexName, boolean ignoreIfExist, boolean defer, Object... fields)
Create a secondary index for the current bucket, with the default management timeout.boolean
createN1qlIndex(String indexName, List<Object> fields, Expression whereClause, boolean ignoreIfExist, boolean defer)
Create a secondary index for the current bucket, with the default management timeout.boolean
createN1qlIndex(String indexName, List<Object> fields, Expression whereClause, boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)
Create a secondary index for the current bucket, with a custom timeout.boolean
createN1qlPrimaryIndex(boolean ignoreIfExist, boolean defer)
Create a primary index for the current bucket, within the default management timeout.boolean
createN1qlPrimaryIndex(boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)
Create a primary index for the current bucket, within a custom timeout.boolean
createN1qlPrimaryIndex(String customName, boolean ignoreIfExist, boolean defer)
Create a custom-named primary index for the current bucket, within the default management timeout.boolean
createN1qlPrimaryIndex(String customName, boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)
Create a custom-named primary index for the current bucket, within a custom timeout.boolean
dropN1qlIndex(String name, boolean ignoreIfNotExist)
Drop the given secondary index associated with the current bucket, within the default management timeout.boolean
dropN1qlIndex(String name, boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)
Drop the given secondary index associated with the current bucket, within a custom timeout.boolean
dropN1qlPrimaryIndex(boolean ignoreIfNotExist)
Drop the default primary index (Index.PRIMARY_NAME
) associated with the current bucket, within the default management timeout.boolean
dropN1qlPrimaryIndex(boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)
Drop the default primary index (Index.PRIMARY_NAME
) associated with the current bucket, within a custom timeout.boolean
dropN1qlPrimaryIndex(String customName, boolean ignoreIfNotExist)
Drop the given custom-named primary index associated with the current bucket, within the default management timeout.boolean
dropN1qlPrimaryIndex(String customName, boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)
Drop the given custom-named primary index associated with the current bucket, within a custom timeout.Boolean
flush()
Flushes the bucket (removes all data) with the default management timeout.Boolean
flush(long timeout, TimeUnit timeUnit)
Flushes the bucket (removes all data) with a custom timeout.DesignDocument
getDesignDocument(String name)
Loads a publishedDesignDocument
by its name with the default management timeout.DesignDocument
getDesignDocument(String name, boolean development)
Loads aDesignDocument
by its name from either development or production with the default management timeout.DesignDocument
getDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)
Loads aDesignDocument
s by its name from either development or production with a custom timeout.DesignDocument
getDesignDocument(String name, long timeout, TimeUnit timeUnit)
Loads a publishedDesignDocument
by its name with the a custom timeout.List<DesignDocument>
getDesignDocuments()
Loads all publishedDesignDocument
s with the default management timeout.List<DesignDocument>
getDesignDocuments(boolean development)
Loads allDesignDocument
s from either development or production with the default management timeout.List<DesignDocument>
getDesignDocuments(boolean development, long timeout, TimeUnit timeUnit)
Loads allDesignDocument
s from either development or production with a custom timeout.List<DesignDocument>
getDesignDocuments(long timeout, TimeUnit timeUnit)
Loads all publishedDesignDocument
s with a custom timeout.BucketInfo
info()
Returns information about the connected bucket with the default management timeout.BucketInfo
info(long timeout, TimeUnit timeUnit)
Returns information about the connected bucket with a custom timeout.DesignDocument
insertDesignDocument(DesignDocument designDocument)
Inserts aDesignDocument
into production if it does not exist with the default management timeout.DesignDocument
insertDesignDocument(DesignDocument designDocument, boolean development)
Inserts aDesignDocument
into development or production if it does not exist with the default management timeout.DesignDocument
insertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)
Inserts aDesignDocument
into development or production if it does not exist with a custom timeout.DesignDocument
insertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)
Inserts aDesignDocument
into production if it does not exist with a custom timeout.List<IndexInfo>
listN1qlIndexes()
List all N1QL GSI indexes that are registered for the current bucket, with the default management timeout.List<IndexInfo>
listN1qlIndexes(long timeout, TimeUnit timeUnit)
List all N1QL GSI indexes that are registered for the current bucket, with a custom timeout.DesignDocument
publishDesignDocument(String name)
Publishes aDesignDocument
from development into production with the default management timeout.DesignDocument
publishDesignDocument(String name, boolean overwrite)
Publishes aDesignDocument
from development into production with the default management timeout.DesignDocument
publishDesignDocument(String name, boolean overwrite, long timeout, TimeUnit timeUnit)
Publishes aDesignDocument
from development into production with a custom timeout.DesignDocument
publishDesignDocument(String name, long timeout, TimeUnit timeUnit)
Publishes aDesignDocument
from development into production with a custom timeout.Boolean
removeDesignDocument(String name)
Removes aDesignDocument
from production by its name with the default management timeout.Boolean
removeDesignDocument(String name, boolean development)
Removes aDesignDocument
from production or development by its name with the default management timeout.Boolean
removeDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)
Removes aDesignDocument
from production or development by its name with a custom timeout.Boolean
removeDesignDocument(String name, long timeout, TimeUnit timeUnit)
Removes aDesignDocument
from production by its name with a custom timeout.DesignDocument
upsertDesignDocument(DesignDocument designDocument)
Upserts (inserts or replaces) aDesignDocument
into production with the default management timeout.DesignDocument
upsertDesignDocument(DesignDocument designDocument, boolean development)
Upserts (inserts or replaces) aDesignDocument
into production or development with the default management timeout.DesignDocument
upsertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)
Upserts (inserts or replaces) aDesignDocument
into production or development with a custom timeout.DesignDocument
upsertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)
Upserts (inserts or replaces) aDesignDocument
into production with a custom timeout.List<IndexInfo>
watchN1qlIndexes(List<String> watchList, long watchTimeout, TimeUnit watchTimeUnit)
Watches all given indexes (possibly including the primary one), polling the query service until they become "online" or the watchTimeout has expired.
-
-
-
Method Detail
-
async
AsyncBucketManager async()
Returns the underlyingAsyncBucketManager
for asynchronous execution.- Returns:
- the underlying bucket manager.
-
info
BucketInfo info()
Returns information about the connected bucket with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.- Returns:
- bucket information wrapped in a
BucketInfo
.
-
info
BucketInfo info(long timeout, TimeUnit timeUnit)
Returns information about the connected bucket with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Parameters:
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- bucket information wrapped in a
BucketInfo
.
-
flush
Boolean flush()
Flushes the bucket (removes all data) with the default management timeout. Note that flushing takes some time on the server to be performed properly, so do not set a too low timeout. Also, flush needs to be enabled on the bucket, otherwise an exception will be raised. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.FlushDisabledException: If flush is disabled. - com.couchbase.client.core.CouchbaseException: If the server response could not be parsed.- Returns:
- true if the bucket was flushed, an exception thrown if otherwise.
-
flush
Boolean flush(long timeout, TimeUnit timeUnit)
Flushes the bucket (removes all data) with a custom timeout. Note that flushing takes some time on the server to be performed properly, so do not set a too low timeout. Also, flush needs to be enabled on the bucket, otherwise an exception will be raised. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.FlushDisabledException: If flush is disabled. - com.couchbase.client.core.CouchbaseException: If the server response could not be parsed.- Parameters:
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- true if the bucket was flushed, an exception thrown if otherwise.
-
getDesignDocuments
List<DesignDocument> getDesignDocuments()
Loads all publishedDesignDocument
s with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Returns:
- a potentially empty list containing published
DesignDocument
s.
-
getDesignDocuments
List<DesignDocument> getDesignDocuments(long timeout, TimeUnit timeUnit)
Loads all publishedDesignDocument
s with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Parameters:
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- a potentially empty list containing published
DesignDocument
s.
-
getDesignDocuments
List<DesignDocument> getDesignDocuments(boolean development)
Loads allDesignDocument
s from either development or production with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Parameters:
development
- ifDesignDocument
s should be loaded from development or from production.- Returns:
- a potentially empty list containing published
DesignDocument
s.
-
getDesignDocuments
List<DesignDocument> getDesignDocuments(boolean development, long timeout, TimeUnit timeUnit)
Loads allDesignDocument
s from either development or production with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Parameters:
development
- ifDesignDocument
s should be loaded from development or from production.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- a potentially empty list containing published
DesignDocument
s.
-
getDesignDocument
DesignDocument getDesignDocument(String name)
Loads a publishedDesignDocument
by its name with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found.- Parameters:
name
- the name of theDesignDocument
.- Returns:
- a
DesignDocument
if found.
-
getDesignDocument
DesignDocument getDesignDocument(String name, long timeout, TimeUnit timeUnit)
Loads a publishedDesignDocument
by its name with the a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found.- Parameters:
name
- the name of theDesignDocument
.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- a
DesignDocument
if found.
-
getDesignDocument
DesignDocument getDesignDocument(String name, boolean development)
Loads aDesignDocument
by its name from either development or production with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found.- Parameters:
name
- the name of theDesignDocument
.development
- ifDesignDocument
should be loaded from development or from production.- Returns:
- a
DesignDocument
if found.
-
getDesignDocument
DesignDocument getDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)
Loads aDesignDocument
s by its name from either development or production with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found.- Parameters:
name
- the name of theDesignDocument
.development
- ifDesignDocument
should be loaded from development or from production.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- a
DesignDocument
if found.
-
insertDesignDocument
DesignDocument insertDesignDocument(DesignDocument designDocument)
Inserts aDesignDocument
into production if it does not exist with the default management timeout. Note that inserting aDesignDocument
is not an atomic operation, but instead internally performs agetDesignDocument(String)
operation first. While expected to be very uncommon, a race condition may happen if two users at the same time perform this operation with the sameDesignDocument
. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocument
exists.- Parameters:
designDocument
- theDesignDocument
to insert.- Returns:
- the inserted
DesignDocument
on success.
-
insertDesignDocument
DesignDocument insertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)
Inserts aDesignDocument
into production if it does not exist with a custom timeout. Note that inserting aDesignDocument
is not an atomic operation, but instead internally performs agetDesignDocument(String)
operation first. While expected to be very uncommon, a race condition may happen if two users at the same time perform this operation with the sameDesignDocument
. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocument
exists.- Parameters:
designDocument
- theDesignDocument
to insert.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- the inserted
DesignDocument
on success.
-
insertDesignDocument
DesignDocument insertDesignDocument(DesignDocument designDocument, boolean development)
Inserts aDesignDocument
into development or production if it does not exist with the default management timeout. Note that inserting aDesignDocument
is not an atomic operation, but instead internally performs agetDesignDocument(String)
operation first. While expected to be very uncommon, a race condition may happen if two users at the same time perform this operation with the sameDesignDocument
. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocument
exists.- Parameters:
designDocument
- theDesignDocument
to insert.development
- if it should be inserted into development or production (published).- Returns:
- the inserted
DesignDocument
on success.
-
insertDesignDocument
DesignDocument insertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)
Inserts aDesignDocument
into development or production if it does not exist with a custom timeout. Note that inserting aDesignDocument
is not an atomic operation, but instead internally performs agetDesignDocument(String)
operation first. While expected to be very uncommon, a race condition may happen if two users at the same time perform this operation with the sameDesignDocument
. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocument
exists.- Parameters:
designDocument
- theDesignDocument
to insert.development
- if it should be inserted into development or production (published).timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- the inserted
DesignDocument
on success.
-
upsertDesignDocument
DesignDocument upsertDesignDocument(DesignDocument designDocument)
Upserts (inserts or replaces) aDesignDocument
into production with the default management timeout. If you want to add or update view definitions to an existing design document, you need to make sure you have all the views (including old ones) in the DesignDocument. UsegetDesignDocument(String)
to get the old list and add your new view to it before calling this method. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Parameters:
designDocument
- theDesignDocument
to upsert.- Returns:
- the upserted
DesignDocument
on success.
-
upsertDesignDocument
DesignDocument upsertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)
Upserts (inserts or replaces) aDesignDocument
into production with a custom timeout. If you want to add or update view definitions to an existing design document, you need to make sure you have all the views (including old ones) in the DesignDocument. UsegetDesignDocument(String)
to get the old list and add your new view to it before calling this method. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Parameters:
designDocument
- theDesignDocument
to upsert.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- the upserted
DesignDocument
on success.
-
upsertDesignDocument
DesignDocument upsertDesignDocument(DesignDocument designDocument, boolean development)
Upserts (inserts or replaces) aDesignDocument
into production or development with the default management timeout. If you want to add or update view definitions to an existing design document, you need to make sure you have all the views (including old ones) in the DesignDocument. UsegetDesignDocument(String)
to get the old list and add your new view to it before calling this method. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Parameters:
designDocument
- theDesignDocument
to upsert.development
- if theDesignDocument
should be upserted into development or production.- Returns:
- the upserted
DesignDocument
on success.
-
upsertDesignDocument
DesignDocument upsertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)
Upserts (inserts or replaces) aDesignDocument
into production or development with a custom timeout. If you want to add or update view definitions to an existing design document, you need to make sure you have all the views (including old ones) in the DesignDocument. UsegetDesignDocument(String)
to get the old list and add your new view to it before calling this method. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Parameters:
designDocument
- theDesignDocument
to upsert.development
- if theDesignDocument
should be upserted into development or production.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- the upserted
DesignDocument
on success.
-
removeDesignDocument
Boolean removeDesignDocument(String name)
Removes aDesignDocument
from production by its name with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found.- Parameters:
name
- the name of theDesignDocument
.- Returns:
- true if succeeded, false otherwise.
-
removeDesignDocument
Boolean removeDesignDocument(String name, long timeout, TimeUnit timeUnit)
Removes aDesignDocument
from production by its name with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found.- Parameters:
name
- the name of theDesignDocument
.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- true if succeeded, false otherwise.
-
removeDesignDocument
Boolean removeDesignDocument(String name, boolean development)
Removes aDesignDocument
from production or development by its name with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found.- Parameters:
name
- the name of theDesignDocument
.development
- if theDesignDocument
should be removed from development or production.- Returns:
- true if succeeded, false otherwise.
-
removeDesignDocument
Boolean removeDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)
Removes aDesignDocument
from production or development by its name with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found.- Parameters:
name
- the name of theDesignDocument
.development
- if theDesignDocument
should be removed from development or production.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- true if succeeded, false otherwise.
-
publishDesignDocument
DesignDocument publishDesignDocument(String name)
Publishes aDesignDocument
from development into production with the default management timeout. Note that this method does not override a already existingDesignDocument
(seepublishDesignDocument(String, boolean)
) as an alternative. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocument
already exists. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found in development.- Parameters:
name
- the name of theDesignDocument
to publish.- Returns:
- the published
DesignDocument
on success.
-
publishDesignDocument
DesignDocument publishDesignDocument(String name, long timeout, TimeUnit timeUnit)
Publishes aDesignDocument
from development into production with a custom timeout. Note that this method does not override a already existingDesignDocument
(seepublishDesignDocument(String, boolean)
) as an alternative. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocument
already exists. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found in development.- Parameters:
name
- the name of theDesignDocument
to publish.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- the published
DesignDocument
on success.
-
publishDesignDocument
DesignDocument publishDesignDocument(String name, boolean overwrite)
Publishes aDesignDocument
from development into production with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocument
already exists and override is set to false. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found in development.- Parameters:
name
- the name of theDesignDocument
to publish.overwrite
- if an existingDesignDocument
should be overridden.- Returns:
- the published
DesignDocument
on success.
-
publishDesignDocument
DesignDocument publishDesignDocument(String name, boolean overwrite, long timeout, TimeUnit timeUnit)
Publishes aDesignDocument
from development into production with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocument
already exists and override is set to false. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocument
is not found in development.- Parameters:
name
- the name of theDesignDocument
to publish.overwrite
- if an existingDesignDocument
should be overridden.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- the published
DesignDocument
on success.
-
listN1qlIndexes
List<IndexInfo> listN1qlIndexes()
List all N1QL GSI indexes that are registered for the current bucket, with the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Returns:
- a List containing each relevant
IndexInfo
(can be empty if no index is defined for this bucket). - Throws:
TranscodingException
- if the server response couldn't be parsed.
-
listN1qlIndexes
List<IndexInfo> listN1qlIndexes(long timeout, TimeUnit timeUnit)
List all N1QL GSI indexes that are registered for the current bucket, with a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Parameters:
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- a List containing each relevant
IndexInfo
(can be empty if no index is defined for this bucket). - Throws:
TranscodingException
- if the server response couldn't be parsed.
-
createN1qlPrimaryIndex
boolean createN1qlPrimaryIndex(boolean ignoreIfExist, boolean defer)
Create a primary index for the current bucket, within the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Parameters:
ignoreIfExist
- if a primary index already exists, an exception will be thrown unless this is set to true.defer
- true to defer building of the index untilbuildN1qlDeferredIndexes()
is called (or a direct call to the corresponding query service API).- Returns:
- true if the index was effectively created, (even in deferred mode) or false if the index existed and ignoreIfExist is true.
- Throws:
IndexAlreadyExistsException
- if the index already exists and ignoreIfExist is set to false.CouchbaseException
- if another error occurs during index creation.
-
createN1qlPrimaryIndex
boolean createN1qlPrimaryIndex(boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)
Create a primary index for the current bucket, within a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Parameters:
ignoreIfExist
- if a primary index already exists, an exception will be thrown unless this is set to true.defer
- true to defer building of the index untilbuildN1qlDeferredIndexes()
is called (or a direct call to the corresponding query service API).timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- true if the index was effectively created, (even in deferred mode) or false if the index existed and ignoreIfExist is true.
- Throws:
IndexAlreadyExistsException
- if the index already exists and ignoreIfExist is set to false.CouchbaseException
- if another error occurs during index creation.
-
createN1qlPrimaryIndex
boolean createN1qlPrimaryIndex(String customName, boolean ignoreIfExist, boolean defer)
Create a custom-named primary index for the current bucket, within the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Parameters:
ignoreIfExist
- if a primary index already exists, an exception will be thrown unless this is set to true.defer
- true to defer building of the index untilbuildN1qlDeferredIndexes()
is called (or a direct call to the corresponding query service API).customName
- the custom name for the primary index.- Returns:
- true if the index was effectively created, (even in deferred mode) or false if the index existed and ignoreIfExist is true.
- Throws:
IndexAlreadyExistsException
- if the index already exists and ignoreIfExist is set to false.CouchbaseException
- if another error occurs during index creation.
-
createN1qlPrimaryIndex
boolean createN1qlPrimaryIndex(String customName, boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)
Create a custom-named primary index for the current bucket, within a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Parameters:
ignoreIfExist
- if a primary index already exists, an exception will be thrown unless this is set to true.defer
- true to defer building of the index untilbuildN1qlDeferredIndexes()
is called (or a direct call to the corresponding query service API).timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.customName
- the custom name for the primary index.- Returns:
- true if the index was effectively created, (even in deferred mode) or false if the index existed and ignoreIfExist is true.
- Throws:
IndexAlreadyExistsException
- if the index already exists and ignoreIfExist is set to false.CouchbaseException
- if another error occurs during index creation.
-
createN1qlIndex
boolean createN1qlIndex(String indexName, boolean ignoreIfExist, boolean defer, Object... fields)
Create a secondary index for the current bucket, with the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name. This method allows to define fields of the index as a vararg, for convenience (actually acceptingExpression
orString
), but has the limitation that a WHERE clause cannot be set.- Parameters:
indexName
- the name of the index.ignoreIfExist
- if a secondary index already exists with that name, an exception will be thrown unless this is set to true.defer
- true to defer building of the index untilbuildN1qlDeferredIndexes()
is called (or a direct call to the corresponding query service API).fields
- the JSON fields to index, in eitherExpression
orString
form.- Returns:
- true if the index was effectively created (even in deferred mode) or false if the index existed and ignoreIfExist is true.
- Throws:
IndexAlreadyExistsException
- if the index already exists and ignoreIfExist is set to false.CouchbaseException
- if another error occurs during index creation.- See Also:
createN1qlIndex(String, List, Expression, boolean, boolean)
-
createN1qlIndex
boolean createN1qlIndex(String indexName, List<Object> fields, Expression whereClause, boolean ignoreIfExist, boolean defer)
Create a secondary index for the current bucket, with the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name. This method allows to define fields of the index as a List, as well as an additionalExpression
for the WHERE clause of the index (which can be null).- Parameters:
indexName
- the name of the index.fields
- the List of JSON fields to index, in eitherExpression
orString
form.whereClause
- theExpression
to use in the WHERE clause of the index.ignoreIfExist
- if a secondary index already exists with that name, an exception will be thrown unless this is set to true.defer
- true to defer building of the index untilbuildN1qlDeferredIndexes()
is called (or a direct call to the corresponding query service API).- Returns:
- true if the index was effectively created (even in deferred mode) or false if the index existed and ignoreIfExist is true.
- Throws:
IndexAlreadyExistsException
- if the index already exists and ignoreIfExist is set to false.CouchbaseException
- if another error occurs during index creation.
-
createN1qlIndex
boolean createN1qlIndex(String indexName, List<Object> fields, Expression whereClause, boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)
Create a secondary index for the current bucket, with a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name. This method allows to define fields of the index as a List, as well as an additionalExpression
for the WHERE clause of the index (which can be null).- Parameters:
indexName
- the name of the index.fields
- the List of JSON fields to index, in eitherExpression
orString
form.whereClause
- theExpression
to use in the WHERE clause of the index.ignoreIfExist
- if a secondary index already exists with that name, an exception will be thrown unless this is set to true.defer
- true to defer building of the index untilbuildN1qlDeferredIndexes()
is called (or a direct call to the corresponding query service API).timeout
- the custom timeout.timeUnit
- the unit for the custom timeout.- Returns:
- true if the index was effectively created (even in deferred mode) or false if the index existed and ignoreIfExist is true.
- Throws:
IndexAlreadyExistsException
- if the index already exists and ignoreIfExist is set to false.CouchbaseException
- if another error occurs during index creation.
-
dropN1qlPrimaryIndex
boolean dropN1qlPrimaryIndex(boolean ignoreIfNotExist)
Drop the default primary index (Index.PRIMARY_NAME
) associated with the current bucket, within the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Parameters:
ignoreIfNotExist
- if true, attempting to drop on a bucket without any primary index won't cause an exception to be propagated.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
- Throws:
IndexDoesNotExistException
- if the primary index doesn't exist and ignoreIfNotExist is set to false.CouchbaseException
- if another error occurs during index drop.
-
dropN1qlPrimaryIndex
boolean dropN1qlPrimaryIndex(boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)
Drop the default primary index (Index.PRIMARY_NAME
) associated with the current bucket, within a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Parameters:
ignoreIfNotExist
- if true, attempting to drop on a bucket without any primary index won't cause an exception to be propagated.timeout
- the custom timeout.timeUnit
- the unit for the custom timeout.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
- Throws:
IndexDoesNotExistException
- if the primary index doesn't exist and ignoreIfNotExist is set to false.CouchbaseException
- if another error occurs during index drop.
-
dropN1qlPrimaryIndex
boolean dropN1qlPrimaryIndex(String customName, boolean ignoreIfNotExist)
Drop the given custom-named primary index associated with the current bucket, within the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Parameters:
ignoreIfNotExist
- if true, attempting to drop on a bucket without any primary index won't cause an exception to be propagated.customName
- the custom name for the primary index.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
- Throws:
IndexDoesNotExistException
- if the primary index doesn't exist and ignoreIfNotExist is set to false.CouchbaseException
- if another error occurs during index drop.
-
dropN1qlPrimaryIndex
boolean dropN1qlPrimaryIndex(String customName, boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)
Drop the given custom-named primary index associated with the current bucket, within a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Parameters:
ignoreIfNotExist
- if true, attempting to drop on a bucket without any primary index won't cause an exception to be propagated.timeout
- the custom timeout.timeUnit
- the unit for the custom timeout.customName
- the custom name for the primary index.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
- Throws:
IndexDoesNotExistException
- if the primary index doesn't exist and ignoreIfNotExist is set to false.CouchbaseException
- if another error occurs during index drop.
-
dropN1qlIndex
boolean dropN1qlIndex(String name, boolean ignoreIfNotExist)
Drop the given secondary index associated with the current bucket, within the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Parameters:
ignoreIfNotExist
- if true, attempting to drop on a bucket without the specified index won't cause an exception to be propagated.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
- Throws:
IndexDoesNotExistException
- if the secondary index doesn't exist and ignoreIfNotExist is set to false.CouchbaseException
- if another error occurs during index drop.
-
dropN1qlIndex
boolean dropN1qlIndex(String name, boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)
Drop the given secondary index associated with the current bucket, within a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Parameters:
ignoreIfNotExist
- if true, attempting to drop on a bucket without the specified index won't cause an exception to be propagated.timeout
- the custom timeout.timeUnit
- the unit for the custom timeout.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
- Throws:
IndexDoesNotExistException
- if the secondary index doesn't exist and ignoreIfNotExist is set to false.CouchbaseException
- if another error occurs during index drop.
-
buildN1qlDeferredIndexes
List<String> buildN1qlDeferredIndexes()
Instruct the query engine to trigger the build of indexes that have been deferred, within the default management timeout. This only considers GSI indexes, as the index management API only deals with this type of indexes. This process itself is asynchronous, meaning that the call will immediately return despite indexes still being in a "pending" or "building" state. This method will return a List of the names of indexes whose build has been triggered.- Returns:
- a
List
of index names, the names of the indexes that have been triggered. - See Also:
to poll for a list of indexes to become online.
-
buildN1qlDeferredIndexes
List<String> buildN1qlDeferredIndexes(long timeout, TimeUnit timeUnit)
Instruct the query engine to trigger the build of indexes that have been deferred, within a custom timeout. This only considers GSI indexes, as the index management API only deals with this type of indexes. This process itself is asynchronous, meaning that the call will immediately return despite indexes still being in a "pending" or "building" state. This method will return a List of the names of indexes whose build has been triggered.- Parameters:
timeout
- the custom timeout.timeUnit
- the unit for the custom timeout.- Returns:
- a
List
of index names, the names of the indexes that have been triggered. - See Also:
to poll for a list of indexes to become online.
-
watchN1qlIndexes
List<IndexInfo> watchN1qlIndexes(List<String> watchList, long watchTimeout, TimeUnit watchTimeUnit)
Watches all given indexes (possibly including the primary one), polling the query service until they become "online" or the watchTimeout has expired. This only considers GSI indexes, as the index management API only deals with this type of indexes. Note: You can activate DEBUG level logs on the "DefaultAsyncBucketManager.INDEX_WATCH_LOG_NAME
" logger to see various stages of the polling. You can also watch a primary index by using theIndex.PRIMARY_NAME
constant.- Parameters:
watchList
- the names of the SECONDARY indexes to watch (can be empty).watchTimeout
- the maximum duration for which to poll for the index to become online.watchTimeUnit
- the time unit for the watchTimeout.- Returns:
- a
List
of theIndexInfo
for the indexes that went online during the watch period. Can be empty if all indexes where online, no index to watch or no index became online within the watchTimeout timeframe.
-
-