Couchbase .NET SDK __CB_SDK_VERSION__

Show / Hide Table of Contents

Class ClusterOptions

Options controlling the connection to the Couchbase cluster.

Inheritance
object
ClusterOptions
Inherited Members
object.GetType()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Couchbase
Assembly: Couchbase.NetClient.dll
Syntax
public sealed class ClusterOptions

Constructors

View Source

ClusterOptions()

Declaration
public ClusterOptions()

Properties

View Source

AnalyticsTimeout

The time to wait before timing out an Analytics request by the client.

Declaration
public TimeSpan AnalyticsTimeout { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 75s.

View Source

AppTelemetry

Declaration
public AppTelemetryOptions AppTelemetry { get; set; }
Property Value
Type Description
AppTelemetryOptions
View Source

Authenticator

The authenticator to use for authenticating connections to Couchbase Server. This and the fluent methods WithAuthenticator(IAuthenticator) are the preferred way to configure authentication in the SDK.

Declaration
public IAuthenticator? Authenticator { get; }
Property Value
Type Description
IAuthenticator
View Source

BootstrapHttpPort

Port used for HTTP bootstrapping fallback if other bootstrap methods are not available. Do not change unless the Cochbase server default ports have be changed.

Declaration
public int BootstrapHttpPort { get; set; }
Property Value
Type Description
int
Remarks

The default is 8091.

View Source

BootstrapHttpPortTls

Port used for TLS HTTP bootstrapping fallback if other bootstrap methods are not available. Do not change unless the Cochbase server default ports have be changed.

Declaration
public int BootstrapHttpPortTls { get; set; }
Property Value
Type Description
int
View Source

BootstrapPollInterval

Used for checking that the SDK has bootstrapped and potentially retrying if not.

Declaration
public TimeSpan BootstrapPollInterval { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 2.5s.

View Source

Buckets

The buckets to be used in the cluster.

Declaration
public IList<string> Buckets { get; set; }
Property Value
Type Description
IList<string>
View Source

CircuitBreakerConfiguration

The configuration for tuning the circuit breaker; if the default is changed ensure that the change is properly measured and tested.

Declaration
public CircuitBreakerConfiguration? CircuitBreakerConfiguration { get; set; }
Property Value
Type Description
CircuitBreakerConfiguration
View Source

Compression

Enables compression for key/value operations.

Declaration
public bool Compression { get; set; }
Property Value
Type Description
bool
Remarks

The value is ignored if no compression algorithm is supplied via WithCompressionAlgorithm(ICompressionAlgorithm). Defaults to true.

View Source

CompressionMinRatio

If compression is enabled, the minimum compression ratio to accept when sending documents to the server. Documents which don't achieve this compression ratio are sent to the server uncompressed.

Declaration
public float CompressionMinRatio { get; set; }
Property Value
Type Description
float
Remarks

1.0 means no compression was achieved. A value of 0.75 would result in documents which compress to at least 75% of their original size to be transmitted compressed. The default is 0.83 (83%).

View Source

CompressionMinSize

If compression is enabled, the minimum document size considered for compression (in bytes). Documents smaller than this size are always sent to the server uncompressed.

Declaration
public int CompressionMinSize { get; set; }
Property Value
Type Description
int
Remarks

The default is 32.

View Source

ConfigIdleRedialTimeout

Not currently used.

Declaration
public TimeSpan ConfigIdleRedialTimeout { get; set; }
Property Value
Type Description
TimeSpan
View Source

ConfigPollFloorInterval

Not currently used.

Declaration
public TimeSpan ConfigPollFloorInterval { get; set; }
Property Value
Type Description
TimeSpan
View Source

ConfigPollInterval

The time between querying the server for new cluster map revisions.

Declaration
public TimeSpan ConfigPollInterval { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 2.5s.

View Source

ConfigUpdatingTimeout

The time to wait for a bucket re-configuration to take place after receiving a new cluster map config.

Declaration
public TimeSpan ConfigUpdatingTimeout { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 15s.

View Source

ConnectionString

The connection string for the cluster.

Declaration
public string? ConnectionString { get; set; }
Property Value
Type Description
string
View Source

Default

Provides a default implementation of ClusterOptions.

Declaration
public static ClusterOptions Default { get; }
Property Value
Type Description
ClusterOptions
View Source

DnsResolver

Provide a custom IDnsResolver for DNS SRV resolution.

Declaration
public IDnsResolver? DnsResolver { get; set; }
Property Value
Type Description
IDnsResolver
View Source

EnableCertificateAuthentication

Declaration
[Obsolete("This property is ignored; set the ClusterOptions.X509CertificateFactory property to a  ICertificateFactory instance - Couchbase.Core.IO.Authentication.X509.CertificateStoreFactory for example.")]
public bool EnableCertificateAuthentication { get; set; }
Property Value
Type Description
bool
View Source

EnableCertificateRevocation

A bool value that specifies whether the certificate revocation list is checked during authentication.

Declaration
public bool EnableCertificateRevocation { get; set; }
Property Value
Type Description
bool
View Source

EnableConfigPolling

Polls the server for cluster map configuration revision changes. This should always be enabled unless debugging the SDK.

Declaration
public bool EnableConfigPolling { get; set; }
Property Value
Type Description
bool
Remarks

This is enabled by default.

View Source

EnableDnsSrvResolution

When bootstrapping, checks first that the connection string is a DNS SRV lookup; this can cause slower bootstrap times if not needed and can be disabled if DNS SRV is not being used.

Declaration
public bool EnableDnsSrvResolution { get; set; }
Property Value
Type Description
bool
Remarks

This is enabled by default.

View Source

EnableExpect100Continue

Declaration
public bool EnableExpect100Continue { get; set; }
Property Value
Type Description
bool
View Source

EnableMutationTokens

Enables mutation tokens for read consistency in Query searches.

Declaration
public bool EnableMutationTokens { get; set; }
Property Value
Type Description
bool
Remarks

They are enabled by default.

View Source

EnableOperationDurationTracing

If true the server duration for an operation will be enabled and the value collected per K/V operation.

Declaration
public bool EnableOperationDurationTracing { get; set; }
Property Value
Type Description
bool
Remarks

The default is enabled.

View Source

EnableTcpKeepAlives

Enables TCP Keep Alives.

Declaration
public bool EnableTcpKeepAlives { get; set; }
Property Value
Type Description
bool
Remarks

This is enabled by default.

View Source

EnableTls

Overrides the TLS behavior in ConnectionString, enabling or disabling TLS.

Declaration
public bool? EnableTls { get; set; }
Property Value
Type Description
bool?
Remarks

Disabled default.

See Also
KvCertificateCallbackValidation
HttpCertificateCallbackValidation
View Source

EnabledSslProtocols

Enabled SSL Protocols

Declaration
[Obsolete("Use TlsSettings.EnabledSslProtocols instead. This property will be removed in a future version.")]
public SslProtocols EnabledSslProtocols { get; set; }
Property Value
Type Description
SslProtocols
Remarks

The defaults TLS1.2 and TLS1.3 if supported. Earlier versions are considered insecure.

View Source

EnabledTlsCipherSuites

List of enabled TLS Cipher Suites. If not set, will use default .NET Cipher Suites

Declaration
public List<TlsCipherSuite>? EnabledTlsCipherSuites { get; set; }
Property Value
Type Description
List<TlsCipherSuite>
View Source

Experiments

Settings to enable various experiments. These experiments may improve performance, but also may have stability issues. If successful, they will become the standard approach.

Declaration
public ExperimentalOptions Experiments { get; set; }
Property Value
Type Description
ExperimentalOptions
View Source

ForceIPv4

Forces the SDK use IPv4 over IPv6

Declaration
public bool ForceIPv4 { get; set; }
Property Value
Type Description
bool
Remarks

Defaults to disabled.

View Source

ForceIpAsTargetHost

If ForceIpAsTargetHost is true, send the IP as the target host during TLS authentication. If ForceIpAsTargetHost is false, then mimic the default SDK2 behavior; the hostname or IP as defined by the server will be sent as the target host during TLS authentication. Note: Setting this to true will cause a certificate name mismatch when connecting to Capella, since the TLS certificate is tied to the hostname.

Declaration
public bool ForceIpAsTargetHost { get; set; }
Property Value
Type Description
bool
Remarks

Only applies when EnableTls is true.

View Source

HttpCertificateCallbackValidation

        The default RemoteCertificateValidationCallback called by .NET to validate the TLS/SSL certificates being used for
        HTTP services (Query, FTS, Analytics, etc).
         If this method returns 
true

, then the certificate will be accepted.

Declaration
[Obsolete("Use TlsSettings.HttpCertificateCallbackValidation instead. This property will be removed in a future version.")]
public RemoteCertificateValidationCallback? HttpCertificateCallbackValidation { get; set; }
Property Value
Type Description
RemoteCertificateValidationCallback
Remarks
        Proper SSL/TLS certificate validation is a complex subject.
        While it can be handy to simply 
return true

for development against self-signed certificates, such a shortcut should never be used against a public-facing or production system.

See Also
KvCertificateCallbackValidation
View Source

HttpConnectionLifetime

Gets or sets how long a connection can be in the pool to be considered reusable.

Declaration
public TimeSpan HttpConnectionLifetime { get; set; }
Property Value
Type Description
TimeSpan
Remarks

Default of zero equates to the SocketsHttpHandler's default of -1 for infinite.

View Source

HttpIgnoreRemoteCertificateMismatch

Ignore CertificateNameMismatch and CertificateChainMismatch for HTTP services (Query, FTS, Analytics, etc), since they happen together.

Declaration
[Obsolete("Use TlsSettings.HttpIgnoreRemoteCertificateNameMismatch instead. This property will be removed in a future version.")]
public bool HttpIgnoreRemoteCertificateMismatch { get; set; }
Property Value
Type Description
bool
Remarks

Intended for development purposes only. Does NOT affect anything other than the name mismatch, such as an untrusted root or an expired certificate.

See Also
KvIgnoreRemoteCertificateNameMismatch
HttpCertificateCallbackValidation
View Source

IdleHttpConnectionTimeout

The maximum time an HTTP connection will remain idle before being considered reusable.

Declaration
public TimeSpan IdleHttpConnectionTimeout { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 1s.

View Source

IdleKvConnectionTimeout

Amount of time with no activity before a key/value connection is considered idle.

Declaration
public TimeSpan IdleKvConnectionTimeout { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 1m.

View Source

IgnoreRemoteCertificateNameMismatch

Ignore CertificateNameMismatch and CertificateChainMismatch, since they happen together.

Declaration
[Obsolete("Use KvIgnoreRemoteCertificateNameMismatch and/or HttpIgnoreRemoteCertificateMismatch instead of this property.")]
public bool IgnoreRemoteCertificateNameMismatch { get; set; }
Property Value
Type Description
bool
View Source

KvCertificateCallbackValidation

        The default <xref href="System.Net.Security.RemoteCertificateValidationCallback" data-throw-if-not-resolved="false"></xref> called by .NET to validate the TLS/SSL certificates being used for
        Key/Value operations. If this method returns 
true

, then the certificate will be accepted.

Declaration
[Obsolete("Use TlsSettings.KvCertificateValidationCallback instead. This property will be removed in a future version.")]
public RemoteCertificateValidationCallback? KvCertificateCallbackValidation { get; set; }
Property Value
Type Description
RemoteCertificateValidationCallback
Remarks
        Proper SSL/TLS certificate validation is a complex subject.
        While it can be handy to simply 
return true

for development against self-signed certificates, such a shortcut should never be used against a public-facing or production system.

View Source

KvConnectTimeout

The time to wait while attempting to connect to a node’s KV service via a socket. Initial connection, reconnecting, node added, etc.

Declaration
public TimeSpan KvConnectTimeout { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 10s.

View Source

KvDurabilityTimeout

The time to wait before timing out a KV operation that is either using synchronous durability or observe-based durability.

Declaration
public TimeSpan KvDurabilityTimeout { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 10s.

View Source

KvIgnoreRemoteCertificateNameMismatch

Ignore CertificateNameMismatch and CertificateChainMismatch for Key/Value operations, since they happen together.

Declaration
[Obsolete("Use TlsSettings.KvIgnoreRemoteCertificateNameMismatch instead. This property will be removed in a future version.")]
public bool KvIgnoreRemoteCertificateNameMismatch { get; set; }
Property Value
Type Description
bool
Remarks

Intended for development purposes only. Does NOT affect anything other than the name mismatch, such as an untrusted root or an expired certificate.

See Also
KvCertificateCallbackValidation
HttpIgnoreRemoteCertificateMismatch
View Source

KvScanTimeout

The time to wait before timing out a KV Range Scan.

Declaration
public TimeSpan KvScanTimeout { get; set; }
Property Value
Type Description
TimeSpan
View Source

KvSendQueueCapacity

Gets or sets the maximum number of operations that will be queued for processing per node. If this value is exceeded, any additional operations will be put into the retry loop.

Declaration
[InterfaceStability(Level.Volatile)]
public uint KvSendQueueCapacity { get; set; }
Property Value
Type Description
uint
Remarks

Defaults to 1024 operations.

View Source

KvTimeout

The time to wait before timing out a KV operation by the client.

Declaration
public TimeSpan KvTimeout { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 2.5s.

View Source

Logging

The ILoggerFactory to use for logging.

Declaration
public ILoggerFactory? Logging { get; set; }
Property Value
Type Description
ILoggerFactory
View Source

LoggingMeterOptions

Configures logging for measuring latencies of the various Couchbase Services.

Declaration
public LoggingMeterOptions LoggingMeterOptions { get; set; }
Property Value
Type Description
LoggingMeterOptions
Remarks

The default is enabled using the LoggingMeter class.

View Source

ManagementTimeout

Number of seconds to wait before timing out a Management API request by the client.

Declaration
public TimeSpan ManagementTimeout { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 75s.

View Source

MaxHttpConnections

Gets or sets the maximum number of simultaneous TCP connections allowed to a single server.

Declaration
public int MaxHttpConnections { get; set; }
Property Value
Type Description
int
Remarks

The default is 0 which equates to the maximum value or Int32.Max.

View Source

MaxKvConnections

Maximum number of connections per key/value node.

Declaration
public int MaxKvConnections { get; set; }
Property Value
Type Description
int
Remarks

The default is 5; use the smallest number possible for best performance. A higher number of socket connections will increase the amount resources used by the server and harm performance.

View Source

NetworkResolution

Specifies the network resolution strategy to use for alternative network; used in some container environments where there maybe internal and external addresses for connecting.

Declaration
public string NetworkResolution { get; set; }
Property Value
Type Description
string
Remarks

The default is "Auto"; Alternative addresses will be used if available.

View Source

NumKvConnections

Minimum number of connections per key/value node.

Declaration
public int NumKvConnections { get; set; }
Property Value
Type Description
int
Remarks

The default is 2; use the smallest number possible for best performance.

View Source

ObservabilitySemanticConvention

Specifies which convention to use

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

OrphanTracingOptions

Configures orphan logging for the SDK. Requires that TracingOptions is enabled (the default).

Declaration
public OrphanOptions OrphanTracingOptions { get; set; }
Property Value
Type Description
OrphanOptions
Remarks

The default is enabled and Couchbase.Core.Diagnostics.Tracing.OrphanResponseReporting.OrphanTraceListener class is used.

View Source

Password

The password for authentication.

Declaration
[Obsolete("Use Authenticator with PasswordAuthenticator instead. This property will be removed in a future version.")]
public string? Password { get; set; }
Property Value
Type Description
string
Remarks

DEPRECATED: Use Authenticator with PasswordAuthenticator instead. This property is maintained for backward compatibility.

View Source

PreferredServerGroup

Sets a preferred server group to target for operations that support this feature. Currently, these are: GetAnyReplica, GetAllReplicas, LookupInAnyReplica, LookupInAllReplicas.

Note that while Server Groups have been available for a long time, this SDK feature is only available using Couchbase Server 7.6.2 and later.

Declaration
[InterfaceStability(Level.Volatile)]
public string? PreferredServerGroup { get; set; }
Property Value
Type Description
string
View Source

QueryTimeout

The time to wait before timing out a Query or N1QL request by the client.

Declaration
public TimeSpan QueryTimeout { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 75s.

View Source

RedactionLevel

The redaction level for log files.

Declaration
public RedactionLevel RedactionLevel { get; set; }
Property Value
Type Description
RedactionLevel
Remarks

The default is None

View Source

RetryStrategy

The IRetryStrategy for operation retries. Applies to all services: K/V, Query, etc.

Declaration
public IRetryStrategy? RetryStrategy { get; set; }
Property Value
Type Description
IRetryStrategy
View Source

SearchTimeout

Number of seconds to wait before timing out a Search request by the client.

Declaration
public TimeSpan SearchTimeout { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 75s.

View Source

Serializer

Provide a custom ITypeSerializer.

Declaration
public ITypeSerializer? Serializer { get; set; }
Property Value
Type Description
ITypeSerializer
View Source

TcpKeepAliveInterval

The duration between two successive keepalive retransmissions, if acknowledgement to the previous keepalive transmission is not received.

Declaration
public TimeSpan TcpKeepAliveInterval { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is every 1s.

View Source

TcpKeepAliveTime

The duration between two keepalive transmissions in idle condition.

Declaration
public TimeSpan TcpKeepAliveTime { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is every 1m.

View Source

ThresholdOptions

Configures threshold logging for the SDK.

Declaration
public ThresholdOptions ThresholdOptions { get; set; }
Property Value
Type Description
ThresholdOptions
Remarks

The default is enabled and Couchbase.Core.Diagnostics.Tracing.ThresholdTracing.ThresholdTraceListener class is used.

View Source

TlsSettings

TLS settings for server certificate validation.

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

TracingOptions

Enables request tracing within the SDK. The default is enabled and the Couchbase.Core.Diagnostics.Tracing.RequestTracer is configured.

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

TransactionsConfig

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

Transcoder

Provide a custom ITypeTranscoder.

Declaration
public ITypeTranscoder? Transcoder { get; set; }
Property Value
Type Description
ITypeTranscoder
View Source

Tuning

Options for performance tuning specific to the .NET SDK.

Declaration
public TuningOptions Tuning { get; set; }
Property Value
Type Description
TuningOptions
View Source

UnorderedExecutionEnabled

Allows unordered execution of commands by the server.

Declaration
public bool UnorderedExecutionEnabled { get; set; }
Property Value
Type Description
bool
Remarks

The default is enabled.

View Source

UserName

The username for authentication.

Declaration
[Obsolete("Use Authenticator with PasswordAuthenticator instead. This property will be removed in a future version.")]
public string? UserName { get; set; }
Property Value
Type Description
string
Remarks

DEPRECATED: Use Authenticator with PasswordAuthenticator instead. This property is maintained for backward compatibility.

View Source

ViewTimeout

The time to wait before timing out a View request by the client.

Declaration
public TimeSpan ViewTimeout { get; set; }
Property Value
Type Description
TimeSpan
Remarks

The default is 75s.

View Source

X509CertificateFactory

Gets or sets the ICertificateFactory to provide client certificates during TLS authentication.

Declaration
[Obsolete("Use Authenticator with CertificateAuthenticator for client certs and TlsSettings for server CAs. This property will be removed in a future version.")]
public ICertificateFactory? X509CertificateFactory { get; set; }
Property Value
Type Description
ICertificateFactory
Remarks

DEPRECATED: Use Authenticator with CertificateAuthenticator instead, and use TlsSettings for server certificate validation. This property is maintained for backward compatibility.

Methods

View Source

AddService<TService, TImplementation>(ClusterServiceLifetime)

Register a service with the cluster's ClusterServices.

Declaration
public ClusterOptions AddService<TService, TImplementation>(ClusterServiceLifetime lifetime) where TImplementation : TService
Parameters
Type Name Description
ClusterServiceLifetime lifetime

Lifetime of the service.

Returns
Type Description
ClusterOptions

The ClusterOptions.

Type Parameters
Name Description
TService

The type of the service which will be requested.

TImplementation

The type of the service implementation which is returned.

View Source

AddService<TService, TImplementation>(Func<IServiceProvider, TImplementation>, ClusterServiceLifetime)

Register a service with the cluster's ClusterServices.

Declaration
public ClusterOptions AddService<TService, TImplementation>(Func<IServiceProvider, TImplementation> factory, ClusterServiceLifetime lifetime) where TImplementation : notnull, TService
Parameters
Type Name Description
Func<IServiceProvider, TImplementation> factory

Factory which will create the service.

ClusterServiceLifetime lifetime

Lifetime of the service.

Returns
Type Description
ClusterOptions

The ClusterOptions.

Type Parameters
Name Description
TService

The type of the service which will be requested.

TImplementation

The type of the service implementation which is returned.

View Source

ApplyProfile(ConfigProfile)

Applies pre-set configuration values based on a named configuration profile. Values defined in the named profile are applied and overwrite existing values. Values not defined in the profile do not overwrite existing values.

Declaration
public ClusterOptions ApplyProfile(ConfigProfile profile)
Parameters
Type Name Description
ConfigProfile profile

The profile to apply.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

ApplyProfile(string)

Applies pre-set configuration values based on a named configuration profile. Values defined in the named profile are applied and overwrite existing values. Values not defined in the profile do not overwrite existing values.

Declaration
[InterfaceStability(Level.Volatile)]
public ClusterOptions ApplyProfile(string profileName)
Parameters
Type Name Description
string profileName

The name of the profile to apply. (e.g. "default" or "wan-development")

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

TryGetRawParameter(string, out object?)

Declaration
public bool TryGetRawParameter(string key, out object? value)
Parameters
Type Name Description
string key
object value
Returns
Type Description
bool
View Source

WithAppTelemetryBackoff(TimeSpan)

Configures the backoff for re-connecting to the AppTelemetry endpoint via WebSockets.

Declaration
[InterfaceStability(Level.Volatile)]
public ClusterOptions WithAppTelemetryBackoff(TimeSpan backoff)
Parameters
Type Name Description
TimeSpan backoff
Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

View Source

WithAppTelemetryEnabled(bool)

Enables/Disables AppTelemetry.

Declaration
[InterfaceStability(Level.Volatile)]
public ClusterOptions WithAppTelemetryEnabled(bool enabled)
Parameters
Type Name Description
bool enabled
Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

View Source

WithAppTelemetryEndpoint(Uri)

Configures the endpoint where AppTelemetry data should be sent to.

Declaration
[InterfaceStability(Level.Volatile)]
public ClusterOptions WithAppTelemetryEndpoint(Uri endpoint)
Parameters
Type Name Description
Uri endpoint
Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

View Source

WithAppTelemetryPingInterval(TimeSpan)

Configures the duration between consecutive PING commands sent to the server.

Declaration
[InterfaceStability(Level.Volatile)]
public ClusterOptions WithAppTelemetryPingInterval(TimeSpan interval)
Parameters
Type Name Description
TimeSpan interval
Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

View Source

WithAppTelemetryPingTimeout(TimeSpan)

Configures the maximum timeout for the server to respond to a PING.

Declaration
[InterfaceStability(Level.Volatile)]
public ClusterOptions WithAppTelemetryPingTimeout(TimeSpan timeout)
Parameters
Type Name Description
TimeSpan timeout
Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

View Source

WithAuthenticator(IAuthenticator)

Sets the authenticator to use for authentication.

Declaration
public ClusterOptions WithAuthenticator(IAuthenticator authenticator)
Parameters
Type Name Description
IAuthenticator authenticator

The authenticator to use.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithBuckets(params string[])

Set the buckets to be used in the cluster.

Declaration
public ClusterOptions WithBuckets(params string[] bucketNames)
Parameters
Type Name Description
string[] bucketNames

The names of the buckets.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithCertificateAuthentication(ICertificateFactory)

Configures certificate-based authentication (mTLS) using the specified certificate factory.

Declaration
public ClusterOptions WithCertificateAuthentication(ICertificateFactory certificateFactory)
Parameters
Type Name Description
ICertificateFactory certificateFactory

The certificate factory to use for providing client certificates.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithCompressionAlgorithm(ICompressionAlgorithm)

Provide a custom ICompressionAlgorithm for key/value body compression.

Declaration
[InterfaceStability(Level.Volatile)]
public ClusterOptions WithCompressionAlgorithm(ICompressionAlgorithm compressionAlgorithm)
Parameters
Type Name Description
ICompressionAlgorithm compressionAlgorithm

Compression algorithm to use.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithCompressionAlgorithm<TImplementation>()

Provide a custom ICompressionAlgorithm for key/value body compression.

Declaration
[InterfaceStability(Level.Volatile)]
public ClusterOptions WithCompressionAlgorithm<TImplementation>() where TImplementation : class, ICompressionAlgorithm
Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

Type Parameters
Name Description
TImplementation

Compression algorithm to use.

View Source

WithConnectionString(string)

Set the connection string for the cluster.

Declaration
public ClusterOptions WithConnectionString(string connectionString)
Parameters
Type Name Description
string connectionString

The connection string.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithCredentials(string, string)

Set credentials used for authentication.

Declaration
[Obsolete("Use WithPasswordAuthentication instead. This method will be removed in a future version.")]
public ClusterOptions WithCredentials(string username, string password)
Parameters
Type Name Description
string username

The username.

string password

The password.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

Remarks

DEPRECATED: Use WithPasswordAuthentication(string, string) instead.

View Source

WithDnsResolver(IDnsResolver)

Provide a custom IDnsResolver for DNS SRV resolution.

Declaration
public ClusterOptions WithDnsResolver(IDnsResolver dnsResolver)
Parameters
Type Name Description
IDnsResolver dnsResolver

DNS resolver to use.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithJwtAuthentication(string)

Configures JWT (JSON Web Token) authentication. Automatically enables TLS as this is required for JWT authentication.

Declaration
[InterfaceStability(Level.Uncommitted)]
public ClusterOptions WithJwtAuthentication(string token)
Parameters
Type Name Description
string token

The JWT token to use for authentication.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithLogging(ILoggerFactory?)

Set the ILoggerFactory to use for logging.

Declaration
public ClusterOptions WithLogging(ILoggerFactory? loggerFactory = null)
Parameters
Type Name Description
ILoggerFactory loggerFactory

The logger factory.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithLoggingMeterOptions(LoggingMeterOptions)

Configures logging for measuring latencies of the various Couchbase Services.

Declaration
public ClusterOptions WithLoggingMeterOptions(LoggingMeterOptions options)
Parameters
Type Name Description
LoggingMeterOptions options

An LoggingMeterOptions object for configuration.

Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

Remarks

The default is enabled using the LoggingMeter class.

View Source

WithLoggingMeterOptions(Action<LoggingMeterOptions>)

Configures logging for measuring latencies of the various Couchbase Services.

Declaration
public ClusterOptions WithLoggingMeterOptions(Action<LoggingMeterOptions> configure)
Parameters
Type Name Description
Action<LoggingMeterOptions> configure

An LoggingMeterOptions lambda for configuration.

Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

Remarks

The default is enabled using the LoggingMeter class.

View Source

WithOrphanTracing(OrphanOptions)

Configures orphan logging for the SDK. Requires that TracingOptions is enabled (the default).

Declaration
public ClusterOptions WithOrphanTracing(OrphanOptions options)
Parameters
Type Name Description
OrphanOptions options

The OrphanOptions object for configuration.

Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

Remarks

The default is enabled and Couchbase.Core.Diagnostics.Tracing.OrphanResponseReporting.OrphanTraceListener class is used.

View Source

WithOrphanTracing(Action<OrphanOptions>)

Configures orphan logging for the SDK. Requires that TracingOptions is enabled (the default).

Declaration
public ClusterOptions WithOrphanTracing(Action<OrphanOptions> configure)
Parameters
Type Name Description
Action<OrphanOptions> configure

The OrphanOptions lambda for configuration.

Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

Remarks

The default is enabled and Couchbase.Core.Diagnostics.Tracing.OrphanResponseReporting.OrphanTraceListener class is used.

View Source

WithPasswordAuthentication(string, string)

Configures password authentication with username and password credentials.

Declaration
public ClusterOptions WithPasswordAuthentication(string username, string password)
Parameters
Type Name Description
string username

The username.

string password

The password.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithPreferredServerGroup(string)

Sets the PreferredServerGroup.

Declaration
[InterfaceStability(Level.Volatile)]
public ClusterOptions WithPreferredServerGroup(string serverGroup)
Parameters
Type Name Description
string serverGroup

The server group to prioritise

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithRetryStrategy(IRetryStrategy)

The IRetryStrategy for operation retries. Applies to all services: K/V, Query, etc.

Declaration
public ClusterOptions WithRetryStrategy(IRetryStrategy retryStrategy)
Parameters
Type Name Description
IRetryStrategy retryStrategy

The custom RetryStrategy.

Returns
Type Description
ClusterOptions
View Source

WithSerializer(ITypeSerializer)

Provide a custom ITypeSerializer.

Declaration
public ClusterOptions WithSerializer(ITypeSerializer serializer)
Parameters
Type Name Description
ITypeSerializer serializer

Serializer to use.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithThresholdTracing(ThresholdOptions)

Configures threshold logging for the SDK.

Declaration
public ClusterOptions WithThresholdTracing(ThresholdOptions options)
Parameters
Type Name Description
ThresholdOptions options

The ThresholdOptions for configuration.

Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

Remarks

The default is enabled and Couchbase.Core.Diagnostics.Tracing.ThresholdTracing.ThresholdTraceListener class is used.

View Source

WithThresholdTracing(Action<ThresholdOptions>)

Configures request tracing for the SDK.

Declaration
public ClusterOptions WithThresholdTracing(Action<ThresholdOptions> configure)
Parameters
Type Name Description
Action<ThresholdOptions> configure

The Action<T> lambda to be configured.

Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

Remarks

The default is enabled and Couchbase.Core.Diagnostics.Tracing.ThresholdTracing.ThresholdTraceListener class is used.

View Source

WithTlsSettings(Action<TlsSettings>)

Configures TLS settings for server certificate validation.

Declaration
public ClusterOptions WithTlsSettings(Action<TlsSettings> configure)
Parameters
Type Name Description
Action<TlsSettings> configure

Action to configure TLS settings.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithTracing(TracingOptions)

Enables request tracing within the SDK. The default is enabled and the Couchbase.Core.Diagnostics.Tracing.RequestTracer is configured.

Declaration
public ClusterOptions WithTracing(TracingOptions options)
Parameters
Type Name Description
TracingOptions options

A TracingOptions object for configuration.

Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

View Source

WithTracing(Action<TracingOptions>)

Enables request tracing within the SDK. The default is enabled and the Couchbase.Core.Diagnostics.Tracing.RequestTracer is configured.

Declaration
public ClusterOptions WithTracing(Action<TracingOptions> configure)
Parameters
Type Name Description
Action<TracingOptions> configure

A TracingOptions lambda for configuration.

Returns
Type Description
ClusterOptions

A ClusterOptions object for chaining.

View Source

WithTranscoder(ITypeTranscoder)

Provide a custom ITypeTranscoder.

Declaration
public ClusterOptions WithTranscoder(ITypeTranscoder transcoder)
Parameters
Type Name Description
ITypeTranscoder transcoder

Transcoder to use.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithTrustedServerCertificates(X509Certificate2Collection)

Configures trusted server CA certificates for server certificate validation.

Declaration
public ClusterOptions WithTrustedServerCertificates(X509Certificate2Collection certificates)
Parameters
Type Name Description
X509Certificate2Collection certificates

The server CA certificates to trust.

Returns
Type Description
ClusterOptions

A reference to this ClusterOptions object for method chaining.

View Source

WithX509CertificateFactory(ICertificateFactory)

Use the given ICertificateFactory to provide client certificates during TLS authentication.

Declaration
[Obsolete("Use WithCertificateAuthentication instead. This method will be removed in a future version.")]
public ClusterOptions WithX509CertificateFactory(ICertificateFactory certificateFactory)
Parameters
Type Name Description
ICertificateFactory certificateFactory

The certificate factory to use.

Returns
Type Description
ClusterOptions

The ClusterOptions to continue configuration in a fluent style.

Remarks

DEPRECATED: Use WithCertificateAuthentication(ICertificateFactory) instead.

Exceptions
Type Condition
NullReferenceException

The certificateFactory parameter cannot be null.

Extension Methods

ClusterOptionsExtensions.AddClusterService<T>(ClusterOptions, T)
ClusterOptionsExtensions.AddClusterService<TService, TImplementation>(ClusterOptions)
ClusterOptionsExtensions.AddClusterService<TService, TImplementation>(ClusterOptions, Func<IServiceProvider, TImplementation>)
ClusterOptionsExtensions.AddClusterService<TService, TImplementation>(ClusterOptions, TImplementation)
ClusterOptionsExtensions.AddTransientService<TService, TImplementation>(ClusterOptions)
ClusterOptionsExtensions.AddTransientService<TService, TImplementation>(ClusterOptions, Func<IServiceProvider, TImplementation>)
SnappierClusterOptionsExtensions.WithSnappyCompression(ClusterOptions)
  • View Source
In this article
Back to top Copyright © 2020 Couchbase, Inc. All rights reserved.