class

CryBase::CouchBase::Client

Inherits CryBase::Interfaces::Client < Reference < Object

Cluster-level client that enumerates and probes every Couchbase service interface (KV, Query, Search, Analytics, Index, Eventing, Views, Management) for the configured hosts, over either plaintext or TLS ports.

No protocol handshake is performed at this layer — connect only validates TCP reachability so callers can confirm the cluster's network surface before driving a service-specific protocol (for example CryBase::CouchBase::Services::KV::Client).

client = CryBase::CouchBase::Client.connect("couchbase://node1,node2")
kv_eps = client.endpoints_for(CryBase::CouchBase::Service::KV)
client.close

Constructors

connect(uri : String, username : String | Nil = nil, password : String | Nil = nil, connect_timeout : Time::Span = 5.seconds) : Client

Builds the client and immediately calls connect. Equivalent to new(...).tap(&.connect).

client = CryBase::CouchBase::Client.connect(
  "couchbases://node1,node2",
  username: "Administrator",
  password: "s3cret",
)
Source
new(uri : String, username : String | Nil = nil, password : String | Nil = nil, connect_timeout : Time::Span = 5.seconds)

Parses uri and pre-computes the full endpoints matrix (one per host × service). No network activity yet.

Source

Instance methods

close

Marks the client as no longer connected?. This layer holds no persistent sockets, so this is purely a state flip.

Source
connect

Probes every endpoint over TCP and returns the reachable subset. Marks the client as connected? if at least one endpoint responded; otherwise raises IO::Error.

reachable = client.connect # => [Endpoint, Endpoint, ...]
Source
connect_timeout
Source
connected?

Whether the client has completed a successful connect.

Source
connection_string

The parsed connection string the client was constructed from.

Source
endpoints
Source
endpoints_for(service : Service) : Array(Endpoint)

Returns every Endpoint for the given service, in host order.

client.endpoints_for(CryBase::CouchBase::Service::KV).map(&.host)
# => ["node1", "node2"]
Source
password
Source
username
Source