class
CryBase::CouchBase::Services::KV::Cluster
- CryBase::CouchBase::Services::KV::Cluster
- Reference
- Object
Overview
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
Defined in:
crybase/couchbase/services/kv/cluster.crConstant Summary
-
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, *, 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.
- .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)
Class Method Summary
-
.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.
Instance Method Summary
-
#active_endpoint : Endpoint | Nil
Returns the endpoint backing the current active pool, or
nilif the cluster is closed before any pool was built. - #bucket : String
- #checkout(& : Client -> T) : T forall T
- #close : Nil
- #closed? : Bool
- #decrement(*args, **kwargs)
- #delete(*args, **kwargs)
- #get(*args, **kwargs)
- #get_as(*args, **kwargs)
- #increment(*args, **kwargs)
- #seeds : Array(Endpoint)
- #set(*args, **kwargs)
- #size : Int32
- #touch(*args, **kwargs)
Constructor Detail
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.
Class Method Detail
Builds one KV endpoint per seed host using the connection string's TLS mode and explicit port, when present.
Instance Method Detail
Returns the endpoint backing the current active pool, or nil if the
cluster is closed before any pool was built.