Search in sources :

Example 1 with KeyValueChannelContext

use of com.couchbase.client.core.io.netty.kv.KeyValueChannelContext in project couchbase-jvm-clients by couchbase.

the class GetCollectionManifestRequest method decode.

@Override
public GetCollectionManifestResponse decode(final ByteBuf response, final KeyValueChannelContext ctx) {
    ResponseStatus status = MemcacheProtocol.decodeStatus(response);
    Optional<String> manifest = Optional.empty();
    if (status.success()) {
        manifest = Optional.of(body(response).map(ByteBufUtil::getBytes).orElse(Bytes.EMPTY_BYTE_ARRAY)).map(b -> new String(b, StandardCharsets.UTF_8));
    }
    return new GetCollectionManifestResponse(status, manifest);
}
Also used : ByteBufUtil(com.couchbase.client.core.deps.io.netty.buffer.ByteBufUtil) MemcacheProtocol.noKey(com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noKey) ByteBufAllocator(com.couchbase.client.core.deps.io.netty.buffer.ByteBufAllocator) MemcacheProtocol.noDatatype(com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noDatatype) Bytes(com.couchbase.client.core.util.Bytes) MemcacheProtocol.noExtras(com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noExtras) StandardCharsets(java.nio.charset.StandardCharsets) MemcacheProtocol.noCas(com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noCas) ResponseStatus(com.couchbase.client.core.msg.ResponseStatus) KeyValueChannelContext(com.couchbase.client.core.io.netty.kv.KeyValueChannelContext) ByteBufUtil(com.couchbase.client.core.deps.io.netty.buffer.ByteBufUtil) CoreContext(com.couchbase.client.core.CoreContext) Duration(java.time.Duration) MemcacheProtocol.noBody(com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noBody) Optional(java.util.Optional) ByteBuf(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf) CollectionIdentifier(com.couchbase.client.core.io.CollectionIdentifier) RetryStrategy(com.couchbase.client.core.retry.RetryStrategy) MemcacheProtocol(com.couchbase.client.core.io.netty.kv.MemcacheProtocol) MemcacheProtocol.noPartition(com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noPartition) MemcacheProtocol.body(com.couchbase.client.core.io.netty.kv.MemcacheProtocol.body) ResponseStatus(com.couchbase.client.core.msg.ResponseStatus)

Aggregations

CoreContext (com.couchbase.client.core.CoreContext)1 ByteBuf (com.couchbase.client.core.deps.io.netty.buffer.ByteBuf)1 ByteBufAllocator (com.couchbase.client.core.deps.io.netty.buffer.ByteBufAllocator)1 ByteBufUtil (com.couchbase.client.core.deps.io.netty.buffer.ByteBufUtil)1 CollectionIdentifier (com.couchbase.client.core.io.CollectionIdentifier)1 KeyValueChannelContext (com.couchbase.client.core.io.netty.kv.KeyValueChannelContext)1 MemcacheProtocol (com.couchbase.client.core.io.netty.kv.MemcacheProtocol)1 MemcacheProtocol.body (com.couchbase.client.core.io.netty.kv.MemcacheProtocol.body)1 MemcacheProtocol.noBody (com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noBody)1 MemcacheProtocol.noCas (com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noCas)1 MemcacheProtocol.noDatatype (com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noDatatype)1 MemcacheProtocol.noExtras (com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noExtras)1 MemcacheProtocol.noKey (com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noKey)1 MemcacheProtocol.noPartition (com.couchbase.client.core.io.netty.kv.MemcacheProtocol.noPartition)1 ResponseStatus (com.couchbase.client.core.msg.ResponseStatus)1 RetryStrategy (com.couchbase.client.core.retry.RetryStrategy)1 Bytes (com.couchbase.client.core.util.Bytes)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Duration (java.time.Duration)1 Optional (java.util.Optional)1