public class DefaultAsyncBucketManager extends Object implements AsyncBucketManager
Default implementation of a AsyncBucketManager.
| Modifier and Type | Method and Description |
|---|---|
static DefaultAsyncBucketManager |
create(String bucket,
String password,
com.couchbase.client.core.ClusterFacade core) |
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<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. |
public static DefaultAsyncBucketManager create(String bucket, String password, com.couchbase.client.core.ClusterFacade core)
public Observable<BucketInfo> info()
AsyncBucketManagerReturns information about the connected bucket.
The Observable can error under the following conditions:
info in interface AsyncBucketManagerBucketInfo.public Observable<Boolean> flush()
AsyncBucketManagerFlushes 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:
flush in interface AsyncBucketManagerObservable otherwise.public Observable<DesignDocument> getDesignDocuments()
AsyncBucketManagerLoads all published DesignDocuments.
The Observable can error under the following conditions:
getDesignDocuments in interface AsyncBucketManagerDesignDocuments.public Observable<DesignDocument> getDesignDocuments(boolean development)
AsyncBucketManagerLoads all DesignDocuments from development or production.
The Observable can error under the following conditions:
getDesignDocuments in interface AsyncBucketManagerdevelopment - if the DesignDocuments should be loaded from development or production.DesignDocuments.public Observable<DesignDocument> getDesignDocument(String name)
AsyncBucketManagerLoads a published DesignDocument by its name.
The Observable can error under the following conditions:
getDesignDocument in interface AsyncBucketManagername - the name of the DesignDocument.DesignDocument.public Observable<DesignDocument> getDesignDocument(String name, boolean development)
AsyncBucketManagerLoads a DesignDocument by its name from either development or production.
The Observable can error under the following conditions:
getDesignDocument in interface AsyncBucketManagername - the name of the DesignDocument.development - if it should be loaded from development or production.DesignDocument.public Observable<DesignDocument> insertDesignDocument(DesignDocument designDocument)
AsyncBucketManagerInserts a DesignDocument into production if it does not exist.
Note that inserting a DesignDocument is not an atomic operation, but instead internally performs a AsyncBucketManager.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.insertDesignDocument in interface AsyncBucketManagerdesignDocument - the DesignDocument to insert.DesignDocument on success.public Observable<DesignDocument> insertDesignDocument(DesignDocument designDocument, boolean development)
AsyncBucketManagerInserts 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 AsyncBucketManager.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.insertDesignDocument in interface AsyncBucketManagerdesignDocument - the DesignDocument to insert.development - if it should be inserted into development or production (published).DesignDocument on success.public Observable<DesignDocument> upsertDesignDocument(DesignDocument designDocument)
AsyncBucketManagerUpserts (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 AsyncBucketManager.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:
upsertDesignDocument in interface AsyncBucketManagerdesignDocument - the DesignDocument to upsert.DesignDocument on success.public Observable<DesignDocument> upsertDesignDocument(DesignDocument designDocument, boolean development)
AsyncBucketManagerUpserts (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 AsyncBucketManager.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:
upsertDesignDocument in interface AsyncBucketManagerdesignDocument - the DesignDocument to upsert.development - if the DesignDocument should be upserted into development or production.DesignDocument on success.public Observable<Boolean> removeDesignDocument(String name)
AsyncBucketManagerRemoves a DesignDocument from production by its name.
removeDesignDocument in interface AsyncBucketManagername - the name of the DesignDocument.public Observable<Boolean> removeDesignDocument(String name, boolean development)
AsyncBucketManagerRemoves a DesignDocument from production or development by its name.
removeDesignDocument in interface AsyncBucketManagername - the name of the DesignDocument.development - if the DesignDocument should be removed from development or production.public Observable<DesignDocument> publishDesignDocument(String name)
AsyncBucketManagerPublishes a DesignDocument from development into production.
Note that this method does not override a already existing DesignDocument (see AsyncBucketManager.publishDesignDocument(String, boolean)) as an alternative.
The Observable can error under the following conditions:
DesignDocument already exists.publishDesignDocument in interface AsyncBucketManagername - the name of the DesignDocument to publish.DesignDocument on success.public Observable<DesignDocument> publishDesignDocument(String name, boolean overwrite)
AsyncBucketManagerPublishes a DesignDocument from development into production.
The Observable can error under the following conditions:
DesignDocument already exists and override is set to false.publishDesignDocument in interface AsyncBucketManagername - the name of the DesignDocument to publish.overwrite - if an existing DesignDocument should be overridden.DesignDocument on success.Copyright © 2015 Couchbase, Inc.. All rights reserved.