Class AsyncCollectionManager
- java.lang.Object
-
- com.couchbase.client.java.manager.collection.AsyncCollectionManager
-
@Volatile public class AsyncCollectionManager extends Object
TheAsyncCollectionManager
provides APIs to manage collections and scopes within a bucket.
-
-
Constructor Summary
Constructors Constructor Description AsyncCollectionManager(CoreCollectionManager coreCollectionManager, AsyncCluster cluster)
Creates a newAsyncCollectionManager
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CompletableFuture<Void>
createCollection(CollectionSpec collectionSpec)
Creates a collection if it does not already exist.CompletableFuture<Void>
createCollection(CollectionSpec collectionSpec, CreateCollectionOptions options)
Creates a collection if it does not already exist with custom options.CompletableFuture<Void>
createScope(String scopeName)
Creates a scope if it does not already exist.CompletableFuture<Void>
createScope(String scopeName, CreateScopeOptions options)
Creates a scope if it does not already exist with custom options.CompletableFuture<Void>
dropCollection(CollectionSpec collectionSpec)
Drops a collection if it exists.CompletableFuture<Void>
dropCollection(CollectionSpec collectionSpec, DropCollectionOptions options)
Drops a collection if it exists with custom options.CompletableFuture<Void>
dropScope(String scopeName)
Drops a scope if it exists.CompletableFuture<Void>
dropScope(String scopeName, DropScopeOptions options)
Drops a scope if it exists with custom options.CompletableFuture<List<ScopeSpec>>
getAllScopes()
Returns all scopes in this bucket.CompletableFuture<List<ScopeSpec>>
getAllScopes(GetAllScopesOptions options)
Returns all scopes in this bucket with custom options.CompletableFuture<ScopeSpec>
getScope(String scopeName)
Deprecated.usegetAllScopes()
instead.CompletableFuture<ScopeSpec>
getScope(String scopeName, GetScopeOptions options)
Deprecated.usegetAllScopes(GetAllScopesOptions)
instead.
-
-
-
Constructor Detail
-
AsyncCollectionManager
@Internal public AsyncCollectionManager(CoreCollectionManager coreCollectionManager, AsyncCluster cluster)
Creates a newAsyncCollectionManager
.This API is not intended to be called by the user directly, use
AsyncBucket.collections()
instead.
-
-
Method Detail
-
createCollection
public CompletableFuture<Void> createCollection(CollectionSpec collectionSpec)
Creates a collection if it does not already exist.Note that a scope needs to be created first (via
createScope(String)
) if it doesn't exist already.- Parameters:
collectionSpec
- the collection spec that contains the properties of the collection.- Returns:
- a
CompletableFuture
completing when the operation is applied or failed with an error. - Throws:
CollectionExistsException
- (async) if the collection already existsScopeNotFoundException
- (async) if the specified scope does not exist.CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
createCollection
public CompletableFuture<Void> createCollection(CollectionSpec collectionSpec, CreateCollectionOptions options)
Creates a collection if it does not already exist with custom options.Note that a scope needs to be created first (via
createScope(String)
) if it doesn't exist already.- Parameters:
collectionSpec
- the collection spec that contains the properties of the collection.options
- the custom options to apply.- Returns:
- a
CompletableFuture
completing when the operation is applied or failed with an error. - Throws:
CollectionExistsException
- (async) if the collection already existsScopeNotFoundException
- (async) if the specified scope does not exist.CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
createScope
public CompletableFuture<Void> createScope(String scopeName)
Creates a scope if it does not already exist.- Parameters:
scopeName
- the name of the scope to create.- Returns:
- a
CompletableFuture
completing when the operation is applied or failed with an error. - Throws:
ScopeExistsException
- (async) if the scope already exists.CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
createScope
public CompletableFuture<Void> createScope(String scopeName, CreateScopeOptions options)
Creates a scope if it does not already exist with custom options.- Parameters:
scopeName
- the name of the scope to create.options
- the custom options to apply.- Returns:
- a
CompletableFuture
completing when the operation is applied or failed with an error. - Throws:
ScopeExistsException
- (async) if the scope already exists.CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
dropCollection
public CompletableFuture<Void> dropCollection(CollectionSpec collectionSpec)
Drops a collection if it exists.- Parameters:
collectionSpec
- the collection spec that contains the properties of the collection.- Returns:
- a
CompletableFuture
completing when the operation is applied or failed with an error. - Throws:
CollectionNotFoundException
- (async) if the collection did not exist.ScopeNotFoundException
- (async) if the specified scope does not exist.CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
dropCollection
public CompletableFuture<Void> dropCollection(CollectionSpec collectionSpec, DropCollectionOptions options)
Drops a collection if it exists with custom options.- Parameters:
collectionSpec
- the collection spec that contains the properties of the collection.options
- the custom options to apply.- Returns:
- a
CompletableFuture
completing when the operation is applied or failed with an error. - Throws:
CollectionNotFoundException
- (async) if the collection did not exist.ScopeNotFoundException
- (async) if the specified scope does not exist.CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
dropScope
public CompletableFuture<Void> dropScope(String scopeName)
Drops a scope if it exists.- Parameters:
scopeName
- the name of the scope to drop.- Returns:
- a
CompletableFuture
completing when the operation is applied or failed with an error. - Throws:
ScopeNotFoundException
- (async) if the scope did not exist.CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
dropScope
public CompletableFuture<Void> dropScope(String scopeName, DropScopeOptions options)
Drops a scope if it exists with custom options.- Parameters:
scopeName
- the name of the scope to drop.options
- the custom options to apply.- Returns:
- a
CompletableFuture
completing when the operation is applied or failed with an error. - Throws:
ScopeNotFoundException
- (async) if the scope did not exist.CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
getScope
@Deprecated public CompletableFuture<ScopeSpec> getScope(String scopeName)
Deprecated.usegetAllScopes()
instead.Returns the scope if it exists.- Parameters:
scopeName
- the name of the scope.- Returns:
- a
CompletableFuture
containing information about the scope. - Throws:
ScopeNotFoundException
- (async) if scope does not exist.CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
getScope
@Deprecated public CompletableFuture<ScopeSpec> getScope(String scopeName, GetScopeOptions options)
Deprecated.usegetAllScopes(GetAllScopesOptions)
instead.Returns the scope if it exists with custom options.- Parameters:
scopeName
- the name of the scope.options
- the custom options to apply.- Returns:
- a
CompletableFuture
containing information about the scope. - Throws:
ScopeNotFoundException
- (async) if scope does not exist.CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
getAllScopes
public CompletableFuture<List<ScopeSpec>> getAllScopes()
Returns all scopes in this bucket.- Returns:
- a
CompletableFuture
with a (potentially empty) list of scopes in the bucket. - Throws:
CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
getAllScopes
public CompletableFuture<List<ScopeSpec>> getAllScopes(GetAllScopesOptions options)
Returns all scopes in this bucket with custom options.- Parameters:
options
- the custom options to apply.- Returns:
- a
CompletableFuture
with a (potentially empty) list of scopes in the bucket. - Throws:
CouchbaseException
- (async) if any other generic unhandled/unexpected errors.
-
-