Couchbase .NET SDK __CB_SDK_VERSION__

Show / Hide Table of Contents

Class Cluster

Inheritance
object
Cluster
Implements
ICluster
ISearchRequester
IDisposable
IAsyncDisposable
IClusterAuthenticator
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Couchbase
Assembly: Couchbase.NetClient.dll
Syntax
public class Cluster : ICluster, ISearchRequester, IDisposable, IAsyncDisposable, IClusterAuthenticator

Properties

View Source

AnalyticsIndexes

Allows a user to manage analytics indexes.

Declaration
public IAnalyticsIndexManager AnalyticsIndexes { get; }
Property Value
Type Description
IAnalyticsIndexManager
View Source

Buckets

Allows a user to manage a couchbase buckets resources.

Declaration
public IBucketManager Buckets { get; }
Property Value
Type Description
IBucketManager
View Source

ClusterServices

An IServiceProvider which provides access to cluster services, such as ITypeSerializer.

Declaration
public IServiceProvider ClusterServices { get; }
Property Value
Type Description
IServiceProvider
View Source

EventingFunctions

Allows a user to read eventing functions, modify them and change their deployment state.

Declaration
public IEventingFunctionManager EventingFunctions { get; }
Property Value
Type Description
IEventingFunctionManager
View Source

QueryIndexes

Allows a user to manage query indexes.

Declaration
public IQueryIndexManager QueryIndexes { get; }
Property Value
Type Description
IQueryIndexManager
View Source

SearchIndexes

Allows a user to manage search indexes.

Declaration
public ISearchIndexManager SearchIndexes { get; }
Property Value
Type Description
ISearchIndexManager
View Source

Transactions

Declaration
public Transactions Transactions { get; }
Property Value
Type Description
Transactions
View Source

Users

Allows a user to manage the users for a couchbase server.

Declaration
public IUserManager Users { get; }
Property Value
Type Description
IUserManager

Methods

View Source

AnalyticsQueryAsync<T>(string, AnalyticsOptions?)

Declaration
public Task<IAnalyticsResult<T>> AnalyticsQueryAsync<T>(string statement, AnalyticsOptions? options = null)
Parameters
Type Name Description
string statement
AnalyticsOptions options
Returns
Type Description
Task<IAnalyticsResult<T>>
Type Parameters
Name Description
T
View Source

Authenticator(IAuthenticator)

Changes the instance of the IAuthenticator used by the cluster.

This method is meant to be used to update the JWT in use by the connections when it expires.

For rotating mTLS client certificates, use an implementation of IRotatingCertificateFactory directly when configuring your ClusterOptions.

Declaration
public void Authenticator(IAuthenticator authenticator)
Parameters
Type Name Description
IAuthenticator authenticator

The new IAuthenticator to use.

Remarks

Note: The type of IAuthenticator should not change at runtime. If you used Password authentication when creating the cluster, you should continue to use Password authentication when changing the authenticator.

For JwtAuthenticator: In addition to applying to new connections, the SDK will asynchronously re-authenticate all existing KV connections using the new JWT.

View Source

BucketAsync(string)

Declaration
public ValueTask<IBucket> BucketAsync(string name)
Parameters
Type Name Description
string name
Returns
Type Description
ValueTask<IBucket>
View Source

ConnectAsync(ClusterOptions)

Declaration
[RequiresUnreferencedCode("The Couchbase SDK might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("The Couchbase SDK might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public static Task<ICluster> ConnectAsync(ClusterOptions options)
Parameters
Type Name Description
ClusterOptions options
Returns
Type Description
Task<ICluster>
View Source

ConnectAsync(ClusterOptions, CancellationToken)

Declaration
[RequiresUnreferencedCode("The Couchbase SDK might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("The Couchbase SDK might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public static Task<ICluster> ConnectAsync(ClusterOptions options, CancellationToken cancellationToken)
Parameters
Type Name Description
ClusterOptions options
CancellationToken cancellationToken
Returns
Type Description
Task<ICluster>
View Source

ConnectAsync(string, ClusterOptions?)

Declaration
[RequiresUnreferencedCode("The Couchbase SDK might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("The Couchbase SDK might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public static Task<ICluster> ConnectAsync(string connectionString, ClusterOptions? options)
Parameters
Type Name Description
string connectionString
ClusterOptions options
Returns
Type Description
Task<ICluster>
View Source

ConnectAsync(string, ClusterOptions?, CancellationToken)

Declaration
[RequiresUnreferencedCode("The Couchbase SDK might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("The Couchbase SDK might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public static Task<ICluster> ConnectAsync(string connectionString, ClusterOptions? options = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string connectionString
ClusterOptions options
CancellationToken cancellationToken
Returns
Type Description
Task<ICluster>
View Source

ConnectAsync(string, Action<ClusterOptions>)

Declaration
[RequiresUnreferencedCode("The Couchbase SDK might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("The Couchbase SDK might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public static Task<ICluster> ConnectAsync(string connectionString, Action<ClusterOptions> configureOptions)
Parameters
Type Name Description
string connectionString
Action<ClusterOptions> configureOptions
Returns
Type Description
Task<ICluster>
View Source

ConnectAsync(string, Action<ClusterOptions>, CancellationToken)

Declaration
[RequiresUnreferencedCode("The Couchbase SDK might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("The Couchbase SDK might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public static Task<ICluster> ConnectAsync(string connectionString, Action<ClusterOptions> configureOptions, CancellationToken cancellationToken)
Parameters
Type Name Description
string connectionString
Action<ClusterOptions> configureOptions
CancellationToken cancellationToken
Returns
Type Description
Task<ICluster>
View Source

ConnectAsync(string, string, string)

Declaration
[RequiresUnreferencedCode("The Couchbase SDK might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("The Couchbase SDK might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public static Task<ICluster> ConnectAsync(string connectionString, string username, string password)
Parameters
Type Name Description
string connectionString
string username
string password
Returns
Type Description
Task<ICluster>
View Source

ConnectAsync(string, string, string, CancellationToken)

Declaration
[RequiresUnreferencedCode("The Couchbase SDK might require types that cannot be statically analyzed. Make sure all required types are preserved.")]
[RequiresDynamicCode("The Couchbase SDK might require types that cannot be statically analyzed and might need runtime code generation. Do not use for native AOT applications.")]
public static Task<ICluster> ConnectAsync(string connectionString, string username, string password, CancellationToken cancellationToken)
Parameters
Type Name Description
string connectionString
string username
string password
CancellationToken cancellationToken
Returns
Type Description
Task<ICluster>
View Source

DiagnosticsAsync(DiagnosticsOptions?)

Creates diagnostic report that can be used to determine the healthfulness of the cluster. It does not proactively perform any I/O against the network.

Declaration
public Task<IDiagnosticsReport> DiagnosticsAsync(DiagnosticsOptions? options = null)
Parameters
Type Name Description
DiagnosticsOptions options

Optional arguments.

Returns
Type Description
Task<IDiagnosticsReport>
View Source

Dispose()

Declaration
public void Dispose()
View Source

DisposeAsync()

Declaration
public ValueTask DisposeAsync()
Returns
Type Description
ValueTask
View Source

EnsureBootstrapped()

Seam for unit tests and for supporting non-GC3P servers (prior to v6.5).

Declaration
protected virtual Task EnsureBootstrapped()
Returns
Type Description
Task
View Source

PingAsync(PingOptions?)

Actively performs I/O by application-level pinging services and returning their pinged status.

Declaration
public Task<IPingReport> PingAsync(PingOptions? options = null)
Parameters
Type Name Description
PingOptions options

Optional arguments.

Returns
Type Description
Task<IPingReport>
View Source

QueryAsync<T>(string, QueryOptions?)

Declaration
public Task<IQueryResult<T>> QueryAsync<T>(string statement, QueryOptions? options = null)
Parameters
Type Name Description
string statement
QueryOptions options
Returns
Type Description
Task<IQueryResult<T>>
Type Parameters
Name Description
T
View Source

SearchAsync(string, SearchRequest, SearchOptions?)

Declaration
public Task<ISearchResult> SearchAsync(string indexName, SearchRequest searchRequest, SearchOptions? options = null)
Parameters
Type Name Description
string indexName
SearchRequest searchRequest
SearchOptions options
Returns
Type Description
Task<ISearchResult>
View Source

SearchQueryAsync(string, ISearchQuery, SearchOptions?)

Declaration
public Task<ISearchResult> SearchQueryAsync(string indexName, ISearchQuery query, SearchOptions? options = null)
Parameters
Type Name Description
string indexName
ISearchQuery query
SearchOptions options
Returns
Type Description
Task<ISearchResult>
View Source

WaitUntilReadyAsync(TimeSpan, WaitUntilReadyOptions?)

Waits until bootstrapping has completed and all services have been initialized.

Declaration
public Task WaitUntilReadyAsync(TimeSpan timeout, WaitUntilReadyOptions? options = null)
Parameters
Type Name Description
TimeSpan timeout

The amount of time to wait for the desired ClusterState.

WaitUntilReadyOptions options

The optional arguments.

Returns
Type Description
Task

Implements

ICluster
ISearchRequester
IDisposable
IAsyncDisposable
IClusterAuthenticator

Extension Methods

AnalyticsExtensions.IngestAsync<T>(ICluster, string, ICouchbaseCollection, IngestOptions)
AnalyticsExtensions.IngestAsync<T>(ICluster, string, ICouchbaseCollection, Action<IngestOptions>)
ClusterExtensions.AnalyticsQueryAsync<T>(ICluster, string, Action<AnalyticsOptions>)
ClusterExtensions.AnalyticsQuery<T>(ICluster, string, AnalyticsOptions)
ClusterExtensions.AnalyticsQuery<T>(ICluster, string, Action<AnalyticsOptions>)
ClusterExtensions.DiagnosticsAsync(ICluster, Action<DiagnosticsOptions>)
ClusterExtensions.QueryAsync<T>(ICluster, string)
ClusterExtensions.QueryAsync<T>(ICluster, string, Action<QueryOptions>)
ClusterExtensions.QueryInterpolatedAsync<T>(ICluster, ref QueryInterpolatedStringHandler)
ClusterExtensions.QueryInterpolatedAsync<T>(ICluster, QueryOptions, ref QueryInterpolatedStringHandler)
ClusterExtensions.QueryInterpolatedAsync<T>(ICluster, Action<QueryOptions>, ref QueryInterpolatedStringHandler)
ClusterExtensions.SearchQueryAsync(ICluster, string, ISearchQuery, Action<SearchOptions>)
  • View Source
In this article
Back to top Copyright © 2020 Couchbase, Inc. All rights reserved.