public class DefaultBucketManager extends Object implements BucketManager
Modifier and Type | Method and Description |
---|---|
AsyncBucketManager |
async()
Returns the underlying
AsyncBucketManager 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.
|
static DefaultBucketManager |
create(CouchbaseEnvironment environment,
String bucket,
String password,
ClusterFacade core) |
static DefaultBucketManager |
create(CouchbaseEnvironment environment,
String bucket,
String username,
String password,
ClusterFacade core) |
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 published
DesignDocument by its name with the default management timeout. |
DesignDocument |
getDesignDocument(String name,
boolean development)
Loads a
DesignDocument by its name from either development or production with the default management
timeout. |
DesignDocument |
getDesignDocument(String name,
boolean development,
long timeout,
TimeUnit timeUnit)
Loads a
DesignDocument s by its name from either development or production with a custom timeout. |
DesignDocument |
getDesignDocument(String name,
long timeout,
TimeUnit timeUnit)
Loads a published
DesignDocument by its name with the a custom timeout. |
List<DesignDocument> |
getDesignDocuments()
Loads all published
DesignDocument s with the default management timeout. |
List<DesignDocument> |
getDesignDocuments(boolean development)
Loads all
DesignDocument s from either development or production with the default management timeout. |
List<DesignDocument> |
getDesignDocuments(boolean development,
long timeout,
TimeUnit timeUnit)
Loads all
DesignDocument s from either development or production with a custom timeout. |
List<DesignDocument> |
getDesignDocuments(long timeout,
TimeUnit timeUnit)
Loads all published
DesignDocument 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 a
DesignDocument into production if it does not exist with the default management timeout. |
DesignDocument |
insertDesignDocument(DesignDocument designDocument,
boolean development)
Inserts a
DesignDocument 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 a
DesignDocument into development or production if it does not exist with a custom timeout. |
DesignDocument |
insertDesignDocument(DesignDocument designDocument,
long timeout,
TimeUnit timeUnit)
Inserts a
DesignDocument 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 a
DesignDocument from development into production with the default management timeout. |
DesignDocument |
publishDesignDocument(String name,
boolean overwrite)
Publishes a
DesignDocument from development into production with the default management timeout. |
DesignDocument |
publishDesignDocument(String name,
boolean overwrite,
long timeout,
TimeUnit timeUnit)
Publishes a
DesignDocument from development into production with a custom timeout. |
DesignDocument |
publishDesignDocument(String name,
long timeout,
TimeUnit timeUnit)
Publishes a
DesignDocument from development into production with a custom timeout. |
Boolean |
removeDesignDocument(String name)
Removes a
DesignDocument from production by its name with the default management timeout. |
Boolean |
removeDesignDocument(String name,
boolean development)
Removes a
DesignDocument from production or development by its name with the default management timeout. |
Boolean |
removeDesignDocument(String name,
boolean development,
long timeout,
TimeUnit timeUnit)
Removes a
DesignDocument from production or development by its name with a custom timeout. |
Boolean |
removeDesignDocument(String name,
long timeout,
TimeUnit timeUnit)
Removes a
DesignDocument from production by its name with a custom timeout. |
DesignDocument |
upsertDesignDocument(DesignDocument designDocument)
Upserts (inserts or replaces) a
DesignDocument into production with the default management timeout. |
DesignDocument |
upsertDesignDocument(DesignDocument designDocument,
boolean development)
Upserts (inserts or replaces) a
DesignDocument into production or development with the default management
timeout. |
DesignDocument |
upsertDesignDocument(DesignDocument designDocument,
boolean development,
long timeout,
TimeUnit timeUnit)
Upserts (inserts or replaces) a
DesignDocument into production or development with a custom timeout. |
DesignDocument |
upsertDesignDocument(DesignDocument designDocument,
long timeout,
TimeUnit timeUnit)
Upserts (inserts or replaces) a
DesignDocument 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.
|
public static DefaultBucketManager create(CouchbaseEnvironment environment, String bucket, String password, ClusterFacade core)
public static DefaultBucketManager create(CouchbaseEnvironment environment, String bucket, String username, String password, ClusterFacade core)
public AsyncBucketManager async()
BucketManager
AsyncBucketManager
for asynchronous execution.async
in interface BucketManager
public BucketInfo info()
BucketManager
info
in interface BucketManager
BucketInfo
.public Boolean flush()
BucketManager
flush
in interface BucketManager
public List<DesignDocument> getDesignDocuments()
BucketManager
DesignDocument
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.getDesignDocuments
in interface BucketManager
DesignDocument
s.public List<DesignDocument> getDesignDocuments(boolean development)
BucketManager
DesignDocument
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.getDesignDocuments
in interface BucketManager
development
- if DesignDocument
s should be loaded from development or from production.DesignDocument
s.public DesignDocument getDesignDocument(String name)
BucketManager
DesignDocument
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: If DesignDocument
is not found.getDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
.DesignDocument
if found.public DesignDocument getDesignDocument(String name, boolean development)
BucketManager
DesignDocument
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: If DesignDocument
is not found.getDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
.development
- if DesignDocument
should be loaded from development or from production.DesignDocument
if found.public DesignDocument insertDesignDocument(DesignDocument designDocument)
BucketManager
DesignDocument
into production if it does not exist with the default management timeout.
Note that inserting a DesignDocument
is not an atomic operation, but instead internally performs a
BucketManager.getDesignDocument(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 same DesignDocument
.
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 the DesignDocument
exists.insertDesignDocument
in interface BucketManager
designDocument
- the DesignDocument
to insert.DesignDocument
on success.public DesignDocument insertDesignDocument(DesignDocument designDocument, boolean development)
BucketManager
DesignDocument
into development or production if it does not exist with the default
management timeout.
Note that inserting a DesignDocument
is not an atomic operation, but instead internally performs a
BucketManager.getDesignDocument(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 same DesignDocument
.
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 the DesignDocument
exists.insertDesignDocument
in interface BucketManager
designDocument
- the DesignDocument
to insert.development
- if it should be inserted into development or production (published).DesignDocument
on success.public DesignDocument upsertDesignDocument(DesignDocument designDocument)
BucketManager
DesignDocument
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. Use BucketManager.getDesignDocument(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.upsertDesignDocument
in interface BucketManager
designDocument
- the DesignDocument
to upsert.DesignDocument
on success.public DesignDocument upsertDesignDocument(DesignDocument designDocument, boolean development)
BucketManager
DesignDocument
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. Use BucketManager.getDesignDocument(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.upsertDesignDocument
in interface BucketManager
designDocument
- the DesignDocument
to upsert.development
- if the DesignDocument
should be upserted into development or production.DesignDocument
on success.public Boolean removeDesignDocument(String name)
BucketManager
DesignDocument
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: If DesignDocument
is not found.removeDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
.public Boolean removeDesignDocument(String name, boolean development)
BucketManager
DesignDocument
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: If DesignDocument
is not found.removeDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
.development
- if the DesignDocument
should be removed from development or production.public DesignDocument publishDesignDocument(String name)
BucketManager
DesignDocument
from development into production with the default management timeout.
Note that this method does not override a already existing DesignDocument
(see BucketManager.publishDesignDocument(String, boolean)
) as an alternative.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If the DesignDocument
already
exists.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.
- com.couchbase.client.java.error.DesignDocumentDoesNotExistException: If DesignDocument
is not found
in development.publishDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
to publish.DesignDocument
on success.public DesignDocument publishDesignDocument(String name, boolean overwrite)
BucketManager
DesignDocument
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 the DesignDocument
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: If DesignDocument
is not found
in development.publishDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
to publish.overwrite
- if an existing DesignDocument
should be overridden.DesignDocument
on success.public BucketInfo info(long timeout, TimeUnit timeUnit)
BucketManager
info
in interface BucketManager
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.BucketInfo
.public Boolean flush(long timeout, TimeUnit timeUnit)
BucketManager
flush
in interface BucketManager
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.public List<DesignDocument> getDesignDocuments(long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
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.getDesignDocuments
in interface BucketManager
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.DesignDocument
s.public List<DesignDocument> getDesignDocuments(boolean development, long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
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.getDesignDocuments
in interface BucketManager
development
- if DesignDocument
s should be loaded from development or from production.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.DesignDocument
s.public DesignDocument getDesignDocument(String name, long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
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: If DesignDocument
is not found.getDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.DesignDocument
if found.public DesignDocument getDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
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: If DesignDocument
is not found.getDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
.development
- if DesignDocument
should be loaded from development or from production.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.DesignDocument
if found.public DesignDocument insertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
into production if it does not exist with a custom timeout.
Note that inserting a DesignDocument
is not an atomic operation, but instead internally performs a
BucketManager.getDesignDocument(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 same DesignDocument
.
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 the DesignDocument
exists.insertDesignDocument
in interface BucketManager
designDocument
- the DesignDocument
to insert.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.DesignDocument
on success.public DesignDocument insertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
into development or production if it does not exist with a custom timeout.
Note that inserting a DesignDocument
is not an atomic operation, but instead internally performs a
BucketManager.getDesignDocument(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 same DesignDocument
.
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 the DesignDocument
exists.insertDesignDocument
in interface BucketManager
designDocument
- the DesignDocument
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.DesignDocument
on success.public DesignDocument upsertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
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. Use BucketManager.getDesignDocument(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.upsertDesignDocument
in interface BucketManager
designDocument
- the DesignDocument
to upsert.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.DesignDocument
on success.public DesignDocument upsertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
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. Use BucketManager.getDesignDocument(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.upsertDesignDocument
in interface BucketManager
designDocument
- the DesignDocument
to upsert.development
- if the DesignDocument
should be upserted into development or production.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.DesignDocument
on success.public Boolean removeDesignDocument(String name, long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
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: If DesignDocument
is not found.removeDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.public Boolean removeDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
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: If DesignDocument
is not found.removeDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
.development
- if the DesignDocument
should be removed from development or production.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.public DesignDocument publishDesignDocument(String name, long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
from development into production with a custom timeout.
Note that this method does not override a already existing DesignDocument
(see BucketManager.publishDesignDocument(String, boolean)
) as an alternative.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If the DesignDocument
already
exists.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.
- com.couchbase.client.java.error.DesignDocumentDoesNotExistException: If DesignDocument
is not found
in development.publishDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
to publish.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.DesignDocument
on success.public DesignDocument publishDesignDocument(String name, boolean overwrite, long timeout, TimeUnit timeUnit)
BucketManager
DesignDocument
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 the DesignDocument
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: If DesignDocument
is not found
in development.publishDesignDocument
in interface BucketManager
name
- the name of the DesignDocument
to publish.overwrite
- if an existing DesignDocument
should be overridden.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.DesignDocument
on success.public List<IndexInfo> listN1qlIndexes()
BucketManager
listN1qlIndexes
in interface BucketManager
IndexInfo
(can be empty if no index
is defined for this bucket).public List<IndexInfo> listN1qlIndexes(long timeout, TimeUnit timeUnit)
BucketManager
listN1qlIndexes
in interface BucketManager
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.IndexInfo
(can be empty if no index
is defined for this bucket).public boolean createN1qlPrimaryIndex(boolean ignoreIfExist, boolean defer)
BucketManager
createN1qlPrimaryIndex
in interface BucketManager
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 until BucketManager.buildN1qlDeferredIndexes()
is called (or a direct call
to the corresponding query service API).public boolean createN1qlPrimaryIndex(boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)
BucketManager
createN1qlPrimaryIndex
in interface BucketManager
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 until BucketManager.buildN1qlDeferredIndexes()
is called (or a direct call
to the corresponding query service API).timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.public boolean createN1qlPrimaryIndex(String customName, boolean ignoreIfExist, boolean defer)
BucketManager
createN1qlPrimaryIndex
in interface BucketManager
customName
- the custom name for the primary index.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 until BucketManager.buildN1qlDeferredIndexes()
is called (or a direct call
to the corresponding query service API).public boolean createN1qlPrimaryIndex(String customName, boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)
BucketManager
createN1qlPrimaryIndex
in interface BucketManager
customName
- the custom name for the primary index.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 until BucketManager.buildN1qlDeferredIndexes()
is called (or a direct call
to the corresponding query service API).timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.public boolean createN1qlIndex(String indexName, boolean ignoreIfExist, boolean defer, Object... fields)
BucketManager
Expression
or String
), but has the limitation that a WHERE clause cannot be set.createN1qlIndex
in interface BucketManager
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 until BucketManager.buildN1qlDeferredIndexes()
is called (or a direct call
to the corresponding query service API).fields
- the JSON fields to index, in either Expression
or String
form.BucketManager.createN1qlIndex(String, List, Expression, boolean, boolean)
public boolean createN1qlIndex(String indexName, List<Object> fields, Expression whereClause, boolean ignoreIfExist, boolean defer)
BucketManager
Expression
for the
WHERE clause of the index (which can be null).createN1qlIndex
in interface BucketManager
indexName
- the name of the index.fields
- the List of JSON fields to index, in either Expression
or String
form.whereClause
- the Expression
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 until BucketManager.buildN1qlDeferredIndexes()
is called (or a direct call
to the corresponding query service API).public boolean createN1qlIndex(String indexName, List<Object> fields, Expression whereClause, boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)
BucketManager
Expression
for the
WHERE clause of the index (which can be null).createN1qlIndex
in interface BucketManager
indexName
- the name of the index.fields
- the List of JSON fields to index, in either Expression
or String
form.whereClause
- the Expression
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 until BucketManager.buildN1qlDeferredIndexes()
is called (or a direct call
to the corresponding query service API).timeout
- the custom timeout.timeUnit
- the unit for the custom timeout.public boolean dropN1qlPrimaryIndex(boolean ignoreIfNotExist)
BucketManager
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.dropN1qlPrimaryIndex
in interface BucketManager
ignoreIfNotExist
- if true, attempting to drop on a bucket without any primary index won't cause an exception to be propagated.public boolean dropN1qlPrimaryIndex(boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)
BucketManager
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.dropN1qlPrimaryIndex
in interface BucketManager
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.public boolean dropN1qlPrimaryIndex(String customName, boolean ignoreIfNotExist)
BucketManager
dropN1qlPrimaryIndex
in interface BucketManager
customName
- the custom name for the primary index.ignoreIfNotExist
- if true, attempting to drop on a bucket without any primary index won't cause an exception to be propagated.public boolean dropN1qlPrimaryIndex(String customName, boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)
BucketManager
dropN1qlPrimaryIndex
in interface BucketManager
customName
- the custom name for the primary index.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.public boolean dropN1qlIndex(String name, boolean ignoreIfNotExist)
BucketManager
dropN1qlIndex
in interface BucketManager
ignoreIfNotExist
- if true, attempting to drop on a bucket without the specified index won't cause an exception to be propagated.public boolean dropN1qlIndex(String name, boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)
BucketManager
dropN1qlIndex
in interface BucketManager
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.public List<String> buildN1qlDeferredIndexes()
BucketManager
buildN1qlDeferredIndexes
in interface BucketManager
List
of index names, the names of the indexes that have been triggered.to poll for a list of indexes to become online.
public List<String> buildN1qlDeferredIndexes(long timeout, TimeUnit timeUnit)
BucketManager
buildN1qlDeferredIndexes
in interface BucketManager
timeout
- the custom timeout.timeUnit
- the unit for the custom timeout.List
of index names, the names of the indexes that have been triggered.to poll for a list of indexes to become online.
public List<IndexInfo> watchN1qlIndexes(List<String> watchList, long watchTimeout, TimeUnit watchTimeUnit)
BucketManager
DefaultAsyncBucketManager.INDEX_WATCH_LOG_NAME
" logger
to see various stages of the polling.
You can also watch a primary index by using the Index.PRIMARY_NAME
constant.watchN1qlIndexes
in interface BucketManager
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.List
of the IndexInfo
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.Copyright © 2015 Couchbase, Inc.