module
CryBase::CouchBase::Services::KV
Overview
Implementation of the Couchbase KV (Data) service over Couchbase's memcached binary protocol, using plaintext or TLS sockets according to the endpoint or connection string.
The main public entry points are KV::Client.from_string for one
authenticated connection, KV::Pool.from_string for a fixed-size pool,
and KV::Cluster.from_string for seed failover across multiple KV hosts.
They accept connection strings with credentials, bucket, explicit KV port,
and TLS query options:
cluster = CryBase::CouchBase::KV::Cluster.from_string(
"couchbases://user:pass@node1,node2:11217/default?tls_verify=false"
)
cluster.set("hello", "world")
cluster.get("hello") # => Bytes containing "world"
cluster.close
You can still construct an Endpoint explicitly or through
CryBase::CouchBase::Endpoint.from_string and pass it to KV::Client.new
or KV::Pool.new when credentials and bucket should stay separate from
the endpoint address.
The namespace is structured as small composable pieces:
KV::Constants— protocol constants used by packet framingKV::Request— value type describing one outbound packetKV::RequestBuffer— serializes one outbound packet into bytesKV::RequestWriter— mixin: writes and flushes a request bufferKV::Response— value type describing one inbound packetKV::ResponseReader— mixin:readdecodes one packet from a socketKV::Bucket— mixin: SELECT_BUCKET handshakeKV::Serializable— typed value codecKV::Pool— fixed-size pool of authenticated clientsKV::Cluster— seed-failover client backed byKV::Pool
KV::Client composes the request/response/bucket mixins, performs
HELLO, SASL_AUTH(PLAIN), and SELECT_BUCKET, then exposes document,
expiry, counter, and typed JSON helper operations.
Defined in:
crybase/couchbase/services/kv.crcrybase/couchbase/services/kv/auth_failed.cr
crybase/couchbase/services/kv/bucket.cr
crybase/couchbase/services/kv/client.cr
crybase/couchbase/services/kv/cluster.cr
crybase/couchbase/services/kv/counter.cr
crybase/couchbase/services/kv/error.cr
crybase/couchbase/services/kv/expiry.cr
crybase/couchbase/services/kv/not_found.cr
crybase/couchbase/services/kv/opcode.cr
crybase/couchbase/services/kv/pool.cr
crybase/couchbase/services/kv/request.cr
crybase/couchbase/services/kv/request_buffer.cr
crybase/couchbase/services/kv/request_writer.cr
crybase/couchbase/services/kv/response.cr
crybase/couchbase/services/kv/response_reader.cr
crybase/couchbase/services/kv/serializable.cr
crybase/couchbase/services/kv/status.cr
crybase/couchbase/services/kv/vbucket.cr
Class Method Summary
- .counter_extras(delta : UInt64, initial : UInt64, expiry : UInt32) : Bytes
- .counter_value(value : Bytes) : UInt64
- .expiry_extras(expiry : UInt32) : Bytes
- .vbucket_id(key : String, count : UInt16 = Constants::VBUCKET_COUNT) : UInt16