Class: Couchbase::Options::Cluster

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/options.rb,
/home/runner/work/couchbase-ruby-client/couchbase-ruby-client/lib/couchbase/options.rb

Overview

Options for Cluster.connect

Examples:

Pass authenticator object to Options

Cluster.connect("couchbase://localhost",
  Options::Cluster(authenticator: PasswordAuthenticator.new("Administrator", "password")))

Shorter version, more useful for interactive sessions

Cluster.connect("couchbase://localhost", "Administrator", "password")

Authentication with TLS client certificate (note couchbases:// schema)

Cluster.connect("couchbases://localhost?trust_certificate=/tmp/ca.pem",
  Options::Cluster(authenticator: CertificateAuthenticator.new("/tmp/certificate.pem", "/tmp/private.key")))

See Also:

Defined Under Namespace

Classes: ApplicationTelemetry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authenticator: nil, preferred_server_group: nil, enable_metrics: nil, metrics_emit_interval: nil, enable_tracing: nil, orphaned_emit_interval: nil, orphaned_sample_size: nil, threshold_emit_interval: nil, threshold_sample_size: nil, key_value_threshold: nil, query_threshold: nil, view_threshold: nil, search_threshold: nil, analytics_threshold: nil, management_threshold: nil, bootstrap_timeout: nil, resolve_timeout: nil, connect_timeout: nil, key_value_timeout: nil, view_timeout: nil, query_timeout: nil, analytics_timeout: nil, search_timeout: nil, management_timeout: nil, dns_srv_timeout: nil, tcp_keep_alive_interval: nil, config_poll_interval: nil, config_poll_floor: nil, config_idle_redial_timeout: nil, idle_http_connection_timeout: nil, tracer: nil, meter: nil, application_telemetry: ApplicationTelemetry.new) {|self| ... } ⇒ Cluster

Creates an instance of options for Cluster.connect

Parameters:

  • authenticator (PasswordAuthenticator, CertificateAuthenticator) (defaults to: nil)
  • preferred_server_group (String) (defaults to: nil) —

    the server group to use for replica APIs e.g. Collection#get_all_replicas

  • key_value_timeout (nil, Integer, #in_milliseconds) (defaults to: nil) —

    default timeout for Key/Value operations, e.g. Collection#get

  • view_timeout (nil, Integer, #in_milliseconds) (defaults to: nil) —

    default timeout for View query

  • query_timeout (nil, Integer, #in_milliseconds) (defaults to: nil) —

    default timeout for N1QL query

  • analytics_timeout (nil, Integer, #in_milliseconds) (defaults to: nil) —

    default timeout for Analytics query

  • search_timeout (nil, Integer, #in_milliseconds) (defaults to: nil) —

    default timeout for Search query

  • management_timeout (nil, Integer, #in_milliseconds) (defaults to: nil) —

    default timeout for management operations

Yield Parameters:

See Also:



1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
# File 'lib/couchbase/options.rb', line 1790

def initialize(authenticator: nil, # rubocop:disable Metrics/ParameterLists
               preferred_server_group: nil,
               enable_metrics: nil,
               metrics_emit_interval: nil,
               enable_tracing: nil,
               orphaned_emit_interval: nil,
               orphaned_sample_size: nil,
               threshold_emit_interval: nil,
               threshold_sample_size: nil,
               key_value_threshold: nil,
               query_threshold: nil,
               view_threshold: nil,
               search_threshold: nil,
               analytics_threshold: nil,
               management_threshold: nil,
               bootstrap_timeout: nil,
               resolve_timeout: nil,
               connect_timeout: nil,
               key_value_timeout: nil,
               view_timeout: nil,
               query_timeout: nil,
               analytics_timeout: nil,
               search_timeout: nil,
               management_timeout: nil,
               dns_srv_timeout: nil,
               tcp_keep_alive_interval: nil,
               config_poll_interval: nil,
               config_poll_floor: nil,
               config_idle_redial_timeout: nil,
               idle_http_connection_timeout: nil,
               tracer: nil,
               meter: nil,
               application_telemetry: ApplicationTelemetry.new)
  @authenticator = authenticator
  @preferred_server_group = preferred_server_group
  @enable_metrics = enable_metrics
  @metrics_emit_interval = metrics_emit_interval
  @enable_tracing = enable_tracing
  @orphaned_emit_interval = orphaned_emit_interval
  @orphaned_sample_size = orphaned_sample_size
  @threshold_emit_interval = threshold_emit_interval
  @threshold_sample_size = threshold_sample_size
  @key_value_threshold = key_value_threshold
  @query_threshold = query_threshold
  @view_threshold = view_threshold
  @search_threshold = search_threshold
  @analytics_threshold = analytics_threshold
  @management_threshold = management_threshold
  @bootstrap_timeout = bootstrap_timeout
  @resolve_timeout = resolve_timeout
  @connect_timeout = connect_timeout
  @key_value_timeout = key_value_timeout
  @view_timeout = view_timeout
  @query_timeout = query_timeout
  @analytics_timeout = analytics_timeout
  @search_timeout = search_timeout
  @management_timeout = management_timeout
  @dns_srv_timeout = dns_srv_timeout
  @tcp_keep_alive_interval = tcp_keep_alive_interval
  @config_poll_interval = config_poll_interval
  @config_poll_floor = config_poll_floor
  @config_idle_redial_timeout = config_idle_redial_timeout
  @idle_http_connection_timeout = idle_http_connection_timeout
  @tracer = tracer
  @meter = meter
  @application_telemetry = application_telemetry

  yield self if block_given?
end

Instance Attribute Details

#analytics_threshold ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1750
1751
1752
# File 'lib/couchbase/options.rb', line 1750

def analytics_threshold
  @analytics_threshold
end

#analytics_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1759
1760
1761
# File 'lib/couchbase/options.rb', line 1759

def analytics_timeout
  @analytics_timeout
end

#application_telemetry ⇒ ApplicationTelemetry

Returns:

Stability:

  • Volatile: This API is subject to change at any time.



1771
1772
1773
# File 'lib/couchbase/options.rb', line 1771

def application_telemetry
  @application_telemetry
end

#authenticator ⇒ PasswordAuthenticator, ...



1735
1736
1737
# File 'lib/couchbase/options.rb', line 1735

def authenticator
  @authenticator
end

#bootstrap_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1753
1754
1755
# File 'lib/couchbase/options.rb', line 1753

def bootstrap_timeout
  @bootstrap_timeout
end

#config_idle_redial_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1766
1767
1768
# File 'lib/couchbase/options.rb', line 1766

def config_idle_redial_timeout
  @config_idle_redial_timeout
end

#config_poll_floor ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1765
1766
1767
# File 'lib/couchbase/options.rb', line 1765

def config_poll_floor
  @config_poll_floor
end

#config_poll_interval ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1764
1765
1766
# File 'lib/couchbase/options.rb', line 1764

def config_poll_interval
  @config_poll_interval
end

#connect_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1755
1756
1757
# File 'lib/couchbase/options.rb', line 1755

def connect_timeout
  @connect_timeout
end

#dns_srv_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1762
1763
1764
# File 'lib/couchbase/options.rb', line 1762

def dns_srv_timeout
  @dns_srv_timeout
end

#enable_metrics ⇒ Boolean

Returns:

  • (Boolean)


1739
1740
1741
# File 'lib/couchbase/options.rb', line 1739

def enable_metrics
  @enable_metrics
end

#enable_tracing ⇒ Boolean

Returns:

  • (Boolean)


1741
1742
1743
# File 'lib/couchbase/options.rb', line 1741

def enable_tracing
  @enable_tracing
end

#idle_http_connection_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1767
1768
1769
# File 'lib/couchbase/options.rb', line 1767

def idle_http_connection_timeout
  @idle_http_connection_timeout
end

#key_value_threshold ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1746
1747
1748
# File 'lib/couchbase/options.rb', line 1746

def key_value_threshold
  @key_value_threshold
end

#key_value_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1756
1757
1758
# File 'lib/couchbase/options.rb', line 1756

def key_value_timeout
  @key_value_timeout
end

#management_threshold ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1751
1752
1753
# File 'lib/couchbase/options.rb', line 1751

def management_threshold
  @management_threshold
end

#management_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1761
1762
1763
# File 'lib/couchbase/options.rb', line 1761

def management_timeout
  @management_timeout
end

#meter ⇒ nil, Metrics::Meter

Returns:



1774
1775
1776
# File 'lib/couchbase/options.rb', line 1774

def meter
  @meter
end

#metrics_emit_interval ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1740
1741
1742
# File 'lib/couchbase/options.rb', line 1740

def metrics_emit_interval
  @metrics_emit_interval
end

#orphaned_emit_interval ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1742
1743
1744
# File 'lib/couchbase/options.rb', line 1742

def orphaned_emit_interval
  @orphaned_emit_interval
end

#orphaned_sample_size ⇒ nil, Integer

Returns:

  • (nil, Integer)


1743
1744
1745
# File 'lib/couchbase/options.rb', line 1743

def orphaned_sample_size
  @orphaned_sample_size
end

#preferred_server_group ⇒ String

Returns:

  • (String)


1737
1738
1739
# File 'lib/couchbase/options.rb', line 1737

def preferred_server_group
  @preferred_server_group
end

#query_threshold ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1747
1748
1749
# File 'lib/couchbase/options.rb', line 1747

def query_threshold
  @query_threshold
end

#query_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1758
1759
1760
# File 'lib/couchbase/options.rb', line 1758

def query_timeout
  @query_timeout
end

#resolve_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1754
1755
1756
# File 'lib/couchbase/options.rb', line 1754

def resolve_timeout
  @resolve_timeout
end

#search_threshold ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1749
1750
1751
# File 'lib/couchbase/options.rb', line 1749

def search_threshold
  @search_threshold
end

#search_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1760
1761
1762
# File 'lib/couchbase/options.rb', line 1760

def search_timeout
  @search_timeout
end

#tcp_keep_alive_interval ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1763
1764
1765
# File 'lib/couchbase/options.rb', line 1763

def tcp_keep_alive_interval
  @tcp_keep_alive_interval
end

#threshold_emit_interval ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1744
1745
1746
# File 'lib/couchbase/options.rb', line 1744

def threshold_emit_interval
  @threshold_emit_interval
end

#threshold_sample_size ⇒ nil, Integer

Returns:

  • (nil, Integer)


1745
1746
1747
# File 'lib/couchbase/options.rb', line 1745

def threshold_sample_size
  @threshold_sample_size
end

#tracer ⇒ nil, Tracing::RequestTracer

Returns:



1773
1774
1775
# File 'lib/couchbase/options.rb', line 1773

def tracer
  @tracer
end

#view_threshold ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1748
1749
1750
# File 'lib/couchbase/options.rb', line 1748

def view_threshold
  @view_threshold
end

#view_timeout ⇒ nil, ...

Returns:

  • (nil, Integer, #in_milliseconds)


1757
1758
1759
# File 'lib/couchbase/options.rb', line 1757

def view_timeout
  @view_timeout
end

Instance Method Details

#apply_profile(profile_name) ⇒ Object

Parameters:

  • profile_name (String) —

    The name of the configuration profile to apply (e.g. "wan_development")



1867
1868
1869
# File 'lib/couchbase/options.rb', line 1867

def apply_profile(profile_name)
  ConfigProfiles::KNOWN_PROFILES.apply(profile_name, self)
end

#authenticate(username, password) ⇒ Object

Parameters:

  • username (String)
  • password (String)


1862
1863
1864
# File 'lib/couchbase/options.rb', line 1862

def authenticate(username, password)
  @authenticator = PasswordAuthenticator.new(username, password)
end