CryBase::CouchBase::Services::KV::Cluster
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.
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)
SourceClass methods
Instance methods
active_endpoint
Returns the endpoint backing the current active pool, or nil if the
cluster is closed before any pool was built.
bucket
Sourcecheckout
Sourceclose
Sourceclosed?
Sourcecollection
Sourcedecrement(*args, **kwargs)
Sourcedelete(*args, **kwargs)
Sourceget(*args, **kwargs)
Sourceget_as(*args, **kwargs)
Sourceincrement(*args, **kwargs)
Sourcescope
Sourceseeds
Sourceset(*args, **kwargs)
Sourcesize
Sourcetouch(*args, **kwargs)
Sourcevbucket_count
Source