Class: Couchbase::Options::Cluster

Inherits:
Object
  • Object
show all
Defined in:
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:

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) {|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:

[View source]

1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
# File 'lib/couchbase/options.rb', line 1723

def 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)
  @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
  yield self if block_given?
end

Instance Attribute Details

#analytics_thresholdnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1690
1691
1692
# File 'lib/couchbase/options.rb', line 1690

def analytics_threshold
  @analytics_threshold
end

#analytics_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1699
1700
1701
# File 'lib/couchbase/options.rb', line 1699

def analytics_timeout
  @analytics_timeout
end

#authenticatorPasswordAuthenticator, CertificateAuthenticator


1675
1676
1677
# File 'lib/couchbase/options.rb', line 1675

def authenticator
  @authenticator
end

#bootstrap_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1693
1694
1695
# File 'lib/couchbase/options.rb', line 1693

def bootstrap_timeout
  @bootstrap_timeout
end

#config_idle_redial_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1706
1707
1708
# File 'lib/couchbase/options.rb', line 1706

def config_idle_redial_timeout
  @config_idle_redial_timeout
end

#config_poll_floornil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1705
1706
1707
# File 'lib/couchbase/options.rb', line 1705

def config_poll_floor
  @config_poll_floor
end

#config_poll_intervalnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1704
1705
1706
# File 'lib/couchbase/options.rb', line 1704

def config_poll_interval
  @config_poll_interval
end

#connect_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1695
1696
1697
# File 'lib/couchbase/options.rb', line 1695

def connect_timeout
  @connect_timeout
end

#dns_srv_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1702
1703
1704
# File 'lib/couchbase/options.rb', line 1702

def dns_srv_timeout
  @dns_srv_timeout
end

#enable_metricsBoolean

Returns:

  • (Boolean)

1679
1680
1681
# File 'lib/couchbase/options.rb', line 1679

def enable_metrics
  @enable_metrics
end

#enable_tracingBoolean

Returns:

  • (Boolean)

1681
1682
1683
# File 'lib/couchbase/options.rb', line 1681

def enable_tracing
  @enable_tracing
end

#idle_http_connection_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1707
1708
1709
# File 'lib/couchbase/options.rb', line 1707

def idle_http_connection_timeout
  @idle_http_connection_timeout
end

#key_value_thresholdnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1686
1687
1688
# File 'lib/couchbase/options.rb', line 1686

def key_value_threshold
  @key_value_threshold
end

#key_value_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1696
1697
1698
# File 'lib/couchbase/options.rb', line 1696

def key_value_timeout
  @key_value_timeout
end

#management_thresholdnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1691
1692
1693
# File 'lib/couchbase/options.rb', line 1691

def management_threshold
  @management_threshold
end

#management_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1701
1702
1703
# File 'lib/couchbase/options.rb', line 1701

def management_timeout
  @management_timeout
end

#metrics_emit_intervalnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1680
1681
1682
# File 'lib/couchbase/options.rb', line 1680

def metrics_emit_interval
  @metrics_emit_interval
end

#orphaned_emit_intervalnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1682
1683
1684
# File 'lib/couchbase/options.rb', line 1682

def orphaned_emit_interval
  @orphaned_emit_interval
end

#orphaned_sample_sizenil, Integer

Returns:

  • (nil, Integer)

1683
1684
1685
# File 'lib/couchbase/options.rb', line 1683

def orphaned_sample_size
  @orphaned_sample_size
end

#preferred_server_groupString

Returns:

  • (String)

1677
1678
1679
# File 'lib/couchbase/options.rb', line 1677

def preferred_server_group
  @preferred_server_group
end

#query_thresholdnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1687
1688
1689
# File 'lib/couchbase/options.rb', line 1687

def query_threshold
  @query_threshold
end

#query_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1698
1699
1700
# File 'lib/couchbase/options.rb', line 1698

def query_timeout
  @query_timeout
end

#resolve_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1694
1695
1696
# File 'lib/couchbase/options.rb', line 1694

def resolve_timeout
  @resolve_timeout
end

#search_thresholdnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1689
1690
1691
# File 'lib/couchbase/options.rb', line 1689

def search_threshold
  @search_threshold
end

#search_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1700
1701
1702
# File 'lib/couchbase/options.rb', line 1700

def search_timeout
  @search_timeout
end

#tcp_keep_alive_intervalnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1703
1704
1705
# File 'lib/couchbase/options.rb', line 1703

def tcp_keep_alive_interval
  @tcp_keep_alive_interval
end

#threshold_emit_intervalnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1684
1685
1686
# File 'lib/couchbase/options.rb', line 1684

def threshold_emit_interval
  @threshold_emit_interval
end

#threshold_sample_sizenil, Integer

Returns:

  • (nil, Integer)

1685
1686
1687
# File 'lib/couchbase/options.rb', line 1685

def threshold_sample_size
  @threshold_sample_size
end

#view_thresholdnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1688
1689
1690
# File 'lib/couchbase/options.rb', line 1688

def view_threshold
  @view_threshold
end

#view_timeoutnil, ...

Returns:

  • (nil, Integer, #in_milliseconds)

1697
1698
1699
# File 'lib/couchbase/options.rb', line 1697

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”)

[View source]

1793
1794
1795
# File 'lib/couchbase/options.rb', line 1793

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

#authenticate(username, password) ⇒ Object

Parameters:

  • username (String)
  • password (String)
[View source]

1788
1789
1790
# File 'lib/couchbase/options.rb', line 1788

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