Home / Class/ BinaryMemcacheObjectAggregator Class — netty Architecture

BinaryMemcacheObjectAggregator Class — netty Architecture

Architecture documentation for the BinaryMemcacheObjectAggregator class in BinaryMemcacheObjectAggregator.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  71b48cdd_3474_4f0b_6eb9_4f124c3da71a["BinaryMemcacheObjectAggregator"]
  6ebefbd3_4b94_23f9_eb60_e7d256f67bdf["BinaryMemcacheObjectAggregator.java"]
  71b48cdd_3474_4f0b_6eb9_4f124c3da71a -->|defined in| 6ebefbd3_4b94_23f9_eb60_e7d256f67bdf
  fbb6c068_b811_e6f8_0f0d_d25687b5abe3["BinaryMemcacheObjectAggregator()"]
  71b48cdd_3474_4f0b_6eb9_4f124c3da71a -->|method| fbb6c068_b811_e6f8_0f0d_d25687b5abe3
  b4c74b1d_9725_b56f_3d46_7f2c46f44485["isStartMessage()"]
  71b48cdd_3474_4f0b_6eb9_4f124c3da71a -->|method| b4c74b1d_9725_b56f_3d46_7f2c46f44485
  6d80932f_df69_7e4b_b59c_b55e2620fd98["FullMemcacheMessage()"]
  71b48cdd_3474_4f0b_6eb9_4f124c3da71a -->|method| 6d80932f_df69_7e4b_b59c_b55e2620fd98
  0f0746ac_8da2_2143_7b3c_97e0738a4b2f["FullBinaryMemcacheRequest()"]
  71b48cdd_3474_4f0b_6eb9_4f124c3da71a -->|method| 0f0746ac_8da2_2143_7b3c_97e0738a4b2f
  ddacc7cf_d708_ffe3_fe8b_60008a566f8d["FullBinaryMemcacheResponse()"]
  71b48cdd_3474_4f0b_6eb9_4f124c3da71a -->|method| ddacc7cf_d708_ffe3_fe8b_60008a566f8d

Relationship Graph

Source Code

codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheObjectAggregator.java lines 33–96

@UnstableApi
public class BinaryMemcacheObjectAggregator extends AbstractMemcacheObjectAggregator<BinaryMemcacheMessage> {

    public BinaryMemcacheObjectAggregator(int maxContentLength) {
        super(maxContentLength);
    }

    @Override
    protected boolean isStartMessage(MemcacheObject msg) throws Exception {
        return msg instanceof BinaryMemcacheMessage;
    }

    @Override
    protected FullMemcacheMessage beginAggregation(BinaryMemcacheMessage start, ByteBuf content) throws Exception {
        if (start instanceof BinaryMemcacheRequest) {
            return toFullRequest((BinaryMemcacheRequest) start, content);
        }

        if (start instanceof BinaryMemcacheResponse) {
            return toFullResponse((BinaryMemcacheResponse) start, content);
        }

        // Should not reach here.
        throw new Error("Unexpected memcache message type: " + className(start));
    }

    private static FullBinaryMemcacheRequest toFullRequest(BinaryMemcacheRequest request, ByteBuf content) {
        ByteBuf key = request.key() == null ? null : request.key().retain();
        ByteBuf extras = request.extras() == null ? null : request.extras().retain();
        DefaultFullBinaryMemcacheRequest fullRequest =
                new DefaultFullBinaryMemcacheRequest(key, extras, content);

        fullRequest.setMagic(request.magic());
        fullRequest.setOpcode(request.opcode());
        fullRequest.setKeyLength(request.keyLength());
        fullRequest.setExtrasLength(request.extrasLength());
        fullRequest.setDataType(request.dataType());
        fullRequest.setTotalBodyLength(request.totalBodyLength());
        fullRequest.setOpaque(request.opaque());
        fullRequest.setCas(request.cas());
        fullRequest.setReserved(request.reserved());

        return fullRequest;
    }

    private static FullBinaryMemcacheResponse toFullResponse(BinaryMemcacheResponse response, ByteBuf content) {
        ByteBuf key = response.key() == null ? null : response.key().retain();
        ByteBuf extras = response.extras() == null ? null : response.extras().retain();
        DefaultFullBinaryMemcacheResponse fullResponse =
                new DefaultFullBinaryMemcacheResponse(key, extras, content);

        fullResponse.setMagic(response.magic());
        fullResponse.setOpcode(response.opcode());
        fullResponse.setKeyLength(response.keyLength());
        fullResponse.setExtrasLength(response.extrasLength());
        fullResponse.setDataType(response.dataType());
        fullResponse.setTotalBodyLength(response.totalBodyLength());
        fullResponse.setOpaque(response.opaque());
        fullResponse.setCas(response.cas());
        fullResponse.setStatus(response.status());

        return fullResponse;
    }
}

Frequently Asked Questions

What is the BinaryMemcacheObjectAggregator class?
BinaryMemcacheObjectAggregator is a class in the netty codebase, defined in codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheObjectAggregator.java.
Where is BinaryMemcacheObjectAggregator defined?
BinaryMemcacheObjectAggregator is defined in codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheObjectAggregator.java at line 33.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free