class

CryBase::CouchBase::Services::KV::Cluster

Inherits Reference < Object

Seed-failover KV client backed by one active KV::Pool.

Cluster accepts a multi-host Couchbase connection string, tries each seed host until one authenticated pool connects, and exposes the same document operation surface as KV::Pool.

This is not vbucket-map routing yet. It is a first cluster layer for seed failover; later routing can replace the single active pool with one pool per node.

cluster = KV::Cluster.from_string("couchbase://user:pass@n1,n2/default")
cluster.set("hello", "world")
cluster.close

Constants

DEFAULT_SIZE = Pool::DEFAULT_SIZE

Constructors

from_string(uri : String, username : String | Nil = nil, password : String | Nil = nil, bucket : String | Nil = nil, size : Int32 = DEFAULT_SIZE, connect_timeout : Time::Span = 5.seconds, *, vbucket_count : UInt16 | Nil = nil, discover_bucket_config : Bool = true, management_port : Int32 | Nil = nil, tls_verify : Bool | Nil = nil, tls_hostname : String | Nil = nil, tls_context : OpenSSL::SSL::Context::Client | Nil = nil) : Cluster

Parses uri, builds KV seed endpoints for every host in the connection string, and connects to the first reachable/authenticated seed.

username, password, and bucket may be passed explicitly or embedded as couchbase://user:pass@host1,host2/bucket.

Source
new(seeds : Array(Endpoint), username : String, password : String, bucket : String, size : Int32 = DEFAULT_SIZE, connect_timeout : Time::Span = 5.seconds, *, tls_verify : Bool = true, tls_hostname : String | Nil = nil, tls_context : OpenSSL::SSL::Context::Client | Nil = nil, vbucket_count : UInt16 = Constants::VBUCKET_COUNT)
Source

Class methods

seed_endpoints(connection_string : ConnectionString) : Array(Endpoint)

Builds one KV endpoint per seed host using the connection string's TLS mode and explicit port, when present.

Source

Instance methods

active_endpoint

Returns the endpoint backing the current active pool, or nil if the cluster is closed before any pool was built.

Source
bucket
Source
bucket=(name : String) : String
Source
checkout
Source
close
Source
closed?
Source
collection(name : String) : CollectionContext(Cluster)
Source
collection
Source
collection=(name : String) : String
Source
collection_id(scope : String, collection : String) : UInt32
Source
decrement(*args, **kwargs)
Source
delete(*args, **kwargs)
Source
get(*args, **kwargs)
Source
get_as(*args, **kwargs)
Source
increment(*args, **kwargs)
Source
scope(name : String) : ScopeContext(Cluster)
Source
scope
Source
scope=(name : String) : String
Source
seeds
Source
set(*args, **kwargs)
Source
size
Source
touch(*args, **kwargs)
Source
vbucket_count
Source
vbucket_count=(count : UInt16) : UInt16
Source