@InterfaceStability.Committed @InterfaceAudience.Public public interface AsyncBucketManager
Provides management capabilities for a AsyncBucket.
Operations provided on the BucketManager can be used to perform administrative tasks which require bucket-level credentials like managing DesignDocuments or flushing a Bucket.
| Modifier and Type | Method and Description |
|---|---|
Observable<List<String>> |
buildDeferredIndexes()
Instruct the query engine to trigger the build of indexes that have been deferred.
|
Observable<Boolean> |
createIndex(String indexName,
boolean ignoreIfExist,
boolean defer,
Object... fields)
Create a secondary index for the current bucket.
|
Observable<Boolean> |
createPrimaryIndex(boolean ignoreIfExist,
boolean defer)
Create a primary index for the current bucket.
|
Observable<Boolean> |
dropIndex(String name,
boolean ignoreIfNotExist)
Drop the given secondary index associated with the current bucket.
|
Observable<Boolean> |
dropPrimaryIndex(boolean ignoreIfNotExist)
Drop the primary index associated with the current bucket.
|
Observable<Boolean> |
flush()
Flushes the bucket (removes all data).
|
Observable<DesignDocument> |
getDesignDocument(String name)
Loads a published
DesignDocument by its name. |
Observable<DesignDocument> |
getDesignDocument(String name,
boolean development)
Loads a
DesignDocument by its name from either development or production. |
Observable<DesignDocument> |
getDesignDocuments()
Loads all published
DesignDocuments. |
Observable<DesignDocument> |
getDesignDocuments(boolean development)
Loads all
DesignDocuments from development or production. |
Observable<BucketInfo> |
info()
Returns information about the connected bucket.
|
Observable<DesignDocument> |
insertDesignDocument(DesignDocument designDocument)
Inserts a
DesignDocument into production if it does not exist. |
Observable<DesignDocument> |
insertDesignDocument(DesignDocument designDocument,
boolean development)
Inserts a
DesignDocument into development or production if it does not exist. |
Observable<IndexInfo> |
listIndexes()
List all N1QL indexes that are registered for the current bucket.
|
Observable<DesignDocument> |
publishDesignDocument(String name)
Publishes a
DesignDocument from development into production. |
Observable<DesignDocument> |
publishDesignDocument(String name,
boolean overwrite)
Publishes a
DesignDocument from development into production. |
Observable<Boolean> |
removeDesignDocument(String name)
Removes a
DesignDocument from production by its name. |
Observable<Boolean> |
removeDesignDocument(String name,
boolean development)
Removes a
DesignDocument from production or development by its name. |
Observable<DesignDocument> |
upsertDesignDocument(DesignDocument designDocument)
Upserts (inserts or replaces) a
DesignDocument into production. |
Observable<DesignDocument> |
upsertDesignDocument(DesignDocument designDocument,
boolean development)
Upserts (inserts or replaces) a
DesignDocument into production or development. |
Observable<IndexInfo> |
watchIndex(String indexName,
long watchTimeout,
TimeUnit watchTimeUnit)
Watches a specific index, polling the query service until the index becomes “online” or the watchTimeout has expired.
|
Observable<IndexInfo> |
watchIndexes(List<String> watchList,
boolean watchPrimary,
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.
|
Observable<BucketInfo> info()
Returns information about the connected bucket.
The Observable can error under the following conditions:
BucketInfo.Observable<Boolean> flush()
Flushes the bucket (removes all data).
Note that flush needs to be enabled on the bucket, otherwise an exception will be raised.
The Observable can error under the following conditions:
Observable otherwise.Observable<DesignDocument> getDesignDocuments()
Loads all published DesignDocuments.
The Observable can error under the following conditions:
DesignDocuments.Observable<DesignDocument> getDesignDocuments(boolean development)
Loads all DesignDocuments from development or production.
The Observable can error under the following conditions:
development - if the DesignDocuments should be loaded from development or production.DesignDocuments.Observable<DesignDocument> getDesignDocument(String name)
Loads a published DesignDocument by its name.
The Observable can error under the following conditions:
name - the name of the DesignDocument.DesignDocument.Observable<DesignDocument> getDesignDocument(String name, boolean development)
Loads a DesignDocument by its name from either development or production.
The Observable can error under the following conditions:
name - the name of the DesignDocument.development - if it should be loaded from development or production.DesignDocument.Observable<DesignDocument> insertDesignDocument(DesignDocument designDocument)
Inserts a DesignDocument into production if it does not exist.
Note that inserting a DesignDocument is not an atomic operation, but instead internally performs a 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.
The Observable can error under the following conditions:
DesignDocument exists.designDocument - the DesignDocument to insert.DesignDocument on success.Observable<DesignDocument> insertDesignDocument(DesignDocument designDocument, boolean development)
Inserts a DesignDocument into development or production if it does not exist.
Note that inserting a DesignDocument is not an atomic operation, but instead internally performs a 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.
The Observable can error under the following conditions:
DesignDocument exists.designDocument - the DesignDocument to insert.development - if it should be inserted into development or production (published).DesignDocument on success.Observable<DesignDocument> upsertDesignDocument(DesignDocument designDocument)
Upserts (inserts or replaces) a DesignDocument into production.
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 getDesignDocument(String) to get the old list and add your new view to it before calling this method.
The Observable can error under the following conditions:
designDocument - the DesignDocument to upsert.DesignDocument on success.Observable<DesignDocument> upsertDesignDocument(DesignDocument designDocument, boolean development)
Upserts (inserts or replaces) a DesignDocument into production or development.
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 getDesignDocument(String) to get the old list and add your new view to it before calling this method.
The Observable can error under the following conditions:
designDocument - the DesignDocument to upsert.development - if the DesignDocument should be upserted into development or production.DesignDocument on success.Observable<Boolean> removeDesignDocument(String name)
Removes a DesignDocument from production by its name.
name - the name of the DesignDocument.Observable<Boolean> removeDesignDocument(String name, boolean development)
Removes a DesignDocument from production or development by its name.
name - the name of the DesignDocument.development - if the DesignDocument should be removed from development or production.Observable<DesignDocument> publishDesignDocument(String name)
Publishes a DesignDocument from development into production.
Note that this method does not override a already existing DesignDocument (see publishDesignDocument(String, boolean)) as an alternative.
The Observable can error under the following conditions:
DesignDocument already exists.name - the name of the DesignDocument to publish.DesignDocument on success.Observable<DesignDocument> publishDesignDocument(String name, boolean overwrite)
Publishes a DesignDocument from development into production.
The Observable can error under the following conditions:
DesignDocument already exists and override is set to false.name - the name of the DesignDocument to publish.overwrite - if an existing DesignDocument should be overridden.DesignDocument on success.@InterfaceStability.Experimental Observable<IndexInfo> listIndexes()
List all N1QL indexes that are registered for the current bucket.
The Observable can error under the following conditions:
TranscodingException if the server response couldn’t be parsed.Observable that will get notified of each relevant IndexInfo (can be empty if no index is defined for this bucket).@InterfaceStability.Experimental Observable<Boolean> createPrimaryIndex(boolean ignoreIfExist, boolean defer)
Create a primary index for the current bucket.
The Observable can error under the following conditions:
CouchbaseException if the index already exists and ignoreIfExist is set to false.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 buildDeferredIndexes() is called (or a direct call to the corresponding query service API).Observable that will get notified with a single Boolean.TRUE if the index was effectively created (even in deferred mode), Boolean.FALSE if the index existed and ignoreIfExist is true.@InterfaceStability.Experimental Observable<Boolean> createIndex(String indexName, boolean ignoreIfExist, boolean defer, Object... fields)
Create a secondary index for the current bucket.
The Observable can error under the following conditions:
CouchbaseException if the index already exists and ignoreIfExist is set to false.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 buildDeferredIndexes() is called (or a direct call to the corresponding query service API).fields - the JSON fields to index, in either Expression or String form.Observable that will get notified with a single Boolean.TRUE if the index was effectively created (even in deferred mode), Boolean.FALSE if the index existed and ignoreIfExist is true.@InterfaceStability.Experimental Observable<Boolean> dropPrimaryIndex(boolean ignoreIfNotExist)
Drop the primary index associated with the current bucket.
The Observable can error under the following conditions:
CouchbaseException if the primary index doesn’t exist and ignoreIfNoExist is set to false.ignoreIfNotExist - if true, attempting to drop on a bucket without any primary index won’t cause an exception to be propagated.Observable that will get notified with a single Boolean.TRUE if the index was effectively dropped.@InterfaceStability.Experimental Observable<Boolean> dropIndex(String name, boolean ignoreIfNotExist)
Drop the given secondary index associated with the current bucket.
The Observable can error under the following conditions:
CouchbaseException if the secondary index doesn’t exist and ignoreIfNoExist is set to false.ignoreIfNotExist - if true, attempting to drop on a bucket without the specified index won’t cause an exception to be propagated.Observable that will get notified with a single Boolean.TRUE if the index was effectively dropped.@InterfaceStability.Experimental Observable<List<String>> buildDeferredIndexes()
Instruct the query engine to trigger the build of indexes that have been deferred.
This process itself is asynchronous, meaning that the call will immediately return despite indexes still being in a “pending” state. This method will return a List of the names of indexes whose build has been triggered, in a single emission.
Observable that will get notified with a single List of index names, the names of the indexes that have been triggered.to poll for a specific index to become online.,
to poll for a list of indexes to become online.@InterfaceStability.Experimental Observable<IndexInfo> watchIndex(String indexName, long watchTimeout, TimeUnit watchTimeUnit)
Watches a specific index, polling the query service until the index becomes “online” or the watchTimeout has expired.
Note: You can activate DEBUG level logs on the “” logger to see various stages of the polling.
indexName - the name of the index to watch. For primary indexes, use Index.PRIMARY_NAME.watchTimeout - the maximum duration for which to poll for the index to become online.watchTimeUnit - the time unit for the watchTimeout.Observable that will get notified with a single IndexInfo on the observed index. If the index couldn’t go online in the specified watchTimeout, the Observable is simply empty.@InterfaceStability.Experimental Observable<IndexInfo> watchIndexes(List<String> watchList, boolean watchPrimary, 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.
Note: You can activate DEBUG level logs on the “” logger to see various stages of the polling.
watchList - the names of the SECONDARY indexes to watch (can be empty).watchPrimary - true if the PRIMARY INDEX should be added to the watchList, false otherwise.watchTimeout - the maximum duration for which to poll for the index to become online.watchTimeUnit - the time unit for the watchTimeout.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.