Class ClusterOptions
Options controlling the connection to the Couchbase cluster.
Inherited Members
Namespace: Couchbase
Assembly: Couchbase.NetClient.dll
Syntax
public sealed class ClusterOptions
Properties
| Edit this page View SourceAnalyticsTimeout
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.
AppTelemetry
Declaration
public AppTelemetryOptions AppTelemetry { get; set; }
Property Value
| Type | Description |
|---|---|
| AppTelemetryOptions |
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.
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 |
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.
Buckets
The buckets to be used in the cluster.
Declaration
public IList<string> Buckets { get; set; }
Property Value
| Type | Description |
|---|---|
| IList<string> |
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 |
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.
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%).
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.
ConfigIdleRedialTimeout
Not currently used.
Declaration
public TimeSpan ConfigIdleRedialTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
ConfigPollFloorInterval
Not currently used.
Declaration
public TimeSpan ConfigPollFloorInterval { get; set; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
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.
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.
ConnectionString
The connection string for the cluster.
Declaration
public string? ConnectionString { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Default
Provides a default implementation of ClusterOptions.
Declaration
public static ClusterOptions Default { get; }
Property Value
| Type | Description |
|---|---|
| ClusterOptions |
DnsResolver
Provide a custom IDnsResolver for DNS SRV resolution.
Declaration
public IDnsResolver? DnsResolver { get; set; }
Property Value
| Type | Description |
|---|---|
| IDnsResolver |
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 |
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 |
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.
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.
EnableExpect100Continue
Declaration
public bool EnableExpect100Continue { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
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.
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.
EnableTcpKeepAlives
Enables TCP Keep Alives.
Declaration
public bool EnableTcpKeepAlives { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
This is enabled by default.
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
| Edit this page View SourceEnabledSslProtocols
Enabled SSL Protocols
Declaration
public SslProtocols EnabledSslProtocols { get; set; }
Property Value
| Type | Description |
|---|---|
| SslProtocols |
Remarks
The defaults is TLS1.2, since earlier protocols are considered insecure.
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 |
ForceIPv4
Forces the SDK use IPv4 over IPv6
Declaration
public bool ForceIPv4 { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Defaults to disabled.
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.
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
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
| Edit this page View SourceHttpConnectionLifetime
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.
HttpIgnoreRemoteCertificateMismatch
Ignore CertificateNameMismatch and CertificateChainMismatch for HTTP services (Query, FTS, Analytics, etc), since they happen together.
Declaration
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
| Edit this page View SourceIdleHttpConnectionTimeout
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.
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.
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 |
KvCertificateCallbackValidation
The default RemoteCertificateValidationCallback 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
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.
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.
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.
KvIgnoreRemoteCertificateNameMismatch
Ignore CertificateNameMismatch and CertificateChainMismatch for Key/Value operations, since they happen together.
Declaration
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
| Edit this page View SourceKvScanTimeout
The time to wait before timing out a KV Range Scan.
Declaration
public TimeSpan KvScanTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
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.
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.
Logging
The ILoggerFactory to use for logging.
Declaration
public ILoggerFactory? Logging { get; set; }
Property Value
| Type | Description |
|---|---|
| ILoggerFactory |
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.
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.
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.
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.
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.
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.
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 OrphanTraceListener class is used.
Password
Declaration
public string? Password { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
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 |
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.
RedactionLevel
The redaction level for log files.
Declaration
public RedactionLevel RedactionLevel { get; set; }
Property Value
| Type | Description |
|---|---|
| RedactionLevel |
Remarks
The default is None
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 |
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.
Serializer
Provide a custom ITypeSerializer.
Declaration
public ITypeSerializer? Serializer { get; set; }
Property Value
| Type | Description |
|---|---|
| ITypeSerializer |
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.
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.
ThresholdOptions
Configures threshold logging for the SDK.
Declaration
public ThresholdOptions ThresholdOptions { get; set; }
Property Value
| Type | Description |
|---|---|
| ThresholdOptions |
Remarks
The default is enabled and ThresholdTraceListener class is used.
TracingOptions
Enables request tracing within the SDK.
Declaration
public TracingOptions TracingOptions { get; set; }
Property Value
| Type | Description |
|---|---|
| TracingOptions |
TransactionsConfig
Declaration
public TransactionsConfig TransactionsConfig { get; set; }
Property Value
| Type | Description |
|---|---|
| TransactionsConfig |
Transcoder
Provide a custom ITypeTranscoder.
Declaration
public ITypeTranscoder? Transcoder { get; set; }
Property Value
| Type | Description |
|---|---|
| ITypeTranscoder |
Tuning
Options for performance tuning specific to the .NET SDK.
Declaration
public TuningOptions Tuning { get; set; }
Property Value
| Type | Description |
|---|---|
| TuningOptions |
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.
UserName
Declaration
public string? UserName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
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.
X509CertificateFactory
Gets or sets the ICertificateFactory to provide client certificates during TLS authentication.
Declaration
public ICertificateFactory? X509CertificateFactory { get; set; }
Property Value
| Type | Description |
|---|---|
| ICertificateFactory |
Methods
| Edit this page View SourceAddService<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. |
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. |
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. |
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. |
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 |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
WithCredentials(string, string)
Set credentials used for authentication.
Declaration
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. |
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. |
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. |
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.
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.
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 OrphanTraceListener class is used.
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 OrphanTraceListener class is used.
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. |
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 |
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. |
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 ThresholdTraceListener class is used.
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 ThresholdTraceListener class is used.
WithTracing(TracingOptions)
Enables request tracing within the SDK.
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. |
WithTracing(Action<TracingOptions>)
Enables request tracing within the SDK.
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. |
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. |
WithX509CertificateFactory(ICertificateFactory)
Use the given ICertificateFactory to provide client certificates during TLS authentication.
Declaration
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. |
Exceptions
| Type | Condition |
|---|---|
| NullReferenceException | The certificateFactory parameter cannot be null. |