public class DefaultAsyncBucketManager extends java.lang.Object implements AsyncBucketManager
Default implementation of a AsyncBucketManager
.
Modifier and Type | Method and Description |
---|---|
static DefaultAsyncBucketManager |
create(java.lang.String bucket,
java.lang.String password,
com.couchbase.client.core.ClusterFacade core) |
rx.Observable<java.lang.Boolean> |
flush()
Flushes the bucket (removes all data).
|
rx.Observable<DesignDocument> |
getDesignDocument(java.lang.String name)
Loads a published
DesignDocument by its name. |
rx.Observable<DesignDocument> |
getDesignDocument(java.lang.String name,
boolean development)
Loads a
DesignDocument by its name from either development or production. |
rx.Observable<DesignDocument> |
getDesignDocuments()
Loads all published
DesignDocument s. |
rx.Observable<DesignDocument> |
getDesignDocuments(boolean development)
Loads all
DesignDocument s from development or production. |
rx.Observable<BucketInfo> |
info()
Returns information about the connected bucket.
|
rx.Observable<DesignDocument> |
insertDesignDocument(DesignDocument designDocument)
Inserts a
DesignDocument into production if it does not exist. |
rx.Observable<DesignDocument> |
insertDesignDocument(DesignDocument designDocument,
boolean development)
Inserts a
DesignDocument into development or production if it does not exist. |
rx.Observable<DesignDocument> |
publishDesignDocument(java.lang.String name)
Publishes a
DesignDocument from development into production. |
rx.Observable<DesignDocument> |
publishDesignDocument(java.lang.String name,
boolean overwrite)
Publishes a
DesignDocument from development into production. |
rx.Observable<java.lang.Boolean> |
removeDesignDocument(java.lang.String name)
Removes a
DesignDocument from production by its name. |
rx.Observable<java.lang.Boolean> |
removeDesignDocument(java.lang.String name,
boolean development)
Removes a
DesignDocument from production or development by its name. |
rx.Observable<DesignDocument> |
upsertDesignDocument(DesignDocument designDocument)
Upserts (inserts or replaces) a
DesignDocument into production. |
rx.Observable<DesignDocument> |
upsertDesignDocument(DesignDocument designDocument,
boolean development)
Upserts (inserts or replaces) a
DesignDocument into production or development. |
public static DefaultAsyncBucketManager create(java.lang.String bucket, java.lang.String password, com.couchbase.client.core.ClusterFacade core)
public rx.Observable<BucketInfo> info()
AsyncBucketManager
Returns information about the connected bucket.
The Observable
can error under the following conditions:
info
in interface AsyncBucketManager
BucketInfo
.public rx.Observable<java.lang.Boolean> flush()
AsyncBucketManager
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:
flush
in interface AsyncBucketManager
Observable
otherwise.public rx.Observable<DesignDocument> getDesignDocuments()
AsyncBucketManager
Loads all published DesignDocument
s.
The Observable
can error under the following conditions:
getDesignDocuments
in interface AsyncBucketManager
DesignDocument
s.public rx.Observable<DesignDocument> getDesignDocuments(boolean development)
AsyncBucketManager
Loads all DesignDocument
s from development or production.
The Observable
can error under the following conditions:
getDesignDocuments
in interface AsyncBucketManager
development
- if the DesignDocument
s should be loaded from development or production.DesignDocument
s.public rx.Observable<DesignDocument> getDesignDocument(java.lang.String name)
AsyncBucketManager
Loads a published DesignDocument
by its name.
The Observable
can error under the following conditions:
getDesignDocument
in interface AsyncBucketManager
name
- the name of the DesignDocument
.DesignDocument
.public rx.Observable<DesignDocument> getDesignDocument(java.lang.String name, boolean development)
AsyncBucketManager
Loads a DesignDocument
by its name from either development or production.
The Observable
can error under the following conditions:
getDesignDocument
in interface AsyncBucketManager
name
- the name of the DesignDocument
.development
- if it should be loaded from development or production.DesignDocument
.public rx.Observable<DesignDocument> insertDesignDocument(DesignDocument designDocument)
AsyncBucketManager
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 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 AsyncBucketManager
designDocument
- the DesignDocument
to insert.DesignDocument
on success.public rx.Observable<DesignDocument> insertDesignDocument(DesignDocument designDocument, boolean development)
AsyncBucketManager
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 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 AsyncBucketManager
designDocument
- the DesignDocument
to insert.development
- if it should be inserted into development or production (published).DesignDocument
on success.public rx.Observable<DesignDocument> upsertDesignDocument(DesignDocument designDocument)
AsyncBucketManager
Upserts (inserts or replaces) a DesignDocument
into production.
The Observable
can error under the following conditions:
upsertDesignDocument
in interface AsyncBucketManager
designDocument
- the DesignDocument
to upsert.DesignDocument
on success.public rx.Observable<DesignDocument> upsertDesignDocument(DesignDocument designDocument, boolean development)
AsyncBucketManager
Upserts (inserts or replaces) a DesignDocument
into production or development.
The Observable
can error under the following conditions:
upsertDesignDocument
in interface AsyncBucketManager
designDocument
- the DesignDocument
to upsert.development
- if the DesignDocument
should be upserted into development or production.DesignDocument
on success.public rx.Observable<java.lang.Boolean> removeDesignDocument(java.lang.String name)
AsyncBucketManager
Removes a DesignDocument
from production by its name.
removeDesignDocument
in interface AsyncBucketManager
name
- the name of the DesignDocument
.public rx.Observable<java.lang.Boolean> removeDesignDocument(java.lang.String name, boolean development)
AsyncBucketManager
Removes a DesignDocument
from production or development by its name.
removeDesignDocument
in interface AsyncBucketManager
name
- the name of the DesignDocument
.development
- if the DesignDocument
should be removed from development or production.public rx.Observable<DesignDocument> publishDesignDocument(java.lang.String name)
AsyncBucketManager
Publishes 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 AsyncBucketManager
name
- the name of the DesignDocument
to publish.DesignDocument
on success.public rx.Observable<DesignDocument> publishDesignDocument(java.lang.String name, boolean overwrite)
AsyncBucketManager
Publishes 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 AsyncBucketManager
name
- the name of the DesignDocument
to publish.overwrite
- if an existing DesignDocument
should be overridden.DesignDocument
on success.