class
CryBase::CouchBase::Client
- CryBase::CouchBase::Client
- CryBase::Interfaces::Client
- Reference
- Object
Overview
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
Defined in:
crybase/couchbase/client.crConstructors
-
.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. -
.new(uri : String, username : String | Nil = nil, password : String | Nil = nil, connect_timeout : Time::Span = 5.seconds)
Parses uri and pre-computes the full
#endpointsmatrix (one per host × service).
Instance Method Summary
-
#close : Nil
Marks the client as no longer
#connected?. -
#connect : Array(Endpoint)
Probes every endpoint over TCP and returns the reachable subset.
- #connect_timeout : Time::Span
-
#connected? : Bool
Whether the client has completed a successful
#connect. -
#connection_string : ConnectionString
The parsed connection string the client was constructed from.
- #endpoints : Array(Endpoint)
-
#endpoints_for(service : Service) : Array(Endpoint)
Returns every
Endpointfor the given service, in host order. - #password : String | Nil
- #username : String | Nil
Instance methods inherited from class CryBase::Interfaces::Client
close : Nil
close,
connected? : Bool
connected?,
connection_string : ConnectionString
connection_string
Constructor Detail
Builds the client and immediately calls #connect. Equivalent to
new(...).tap(&.connect).
client = CryBase::CouchBase::Client.connect(
"couchbases://node1,node2",
username: "Administrator",
password: "s3cret",
)
Parses uri and pre-computes the full #endpoints matrix
(one per host × service). No network activity yet.
Instance Method Detail
Marks the client as no longer #connected?. This layer holds no
persistent sockets, so this is purely a state flip.
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, ...]
Whether the client has completed a successful #connect.
The parsed connection string the client was constructed from.
Returns every Endpoint for the given service, in host order.
client.endpoints_for(CryBase::CouchBase::Service::KV).map(&.host)
# => ["node1", "node2"]