Home / Function/ tryEncodeWithDynamicTable() — netty Function Reference

tryEncodeWithDynamicTable() — netty Function Reference

Architecture documentation for the tryEncodeWithDynamicTable() function in QpackEncoder.java from the netty codebase.

Function java Buffer Allocators calls 7 called by 2

Entity Profile

Dependency Diagram

graph TD
  e5dd0675_23b6_2e4d_161a_a83f05c006a9["tryEncodeWithDynamicTable()"]
  9e578dbc_12be_4439_554b_24e265961ea5["QpackEncoder"]
  e5dd0675_23b6_2e4d_161a_a83f05c006a9 -->|defined in| 9e578dbc_12be_4439_554b_24e265961ea5
  4290254a_d002_4407_68f0_95045618c5ff["encodeHeader()"]
  4290254a_d002_4407_68f0_95045618c5ff -->|calls| e5dd0675_23b6_2e4d_161a_a83f05c006a9
  e6a8c78f_612c_a898_3946_dd974c0e8e72["encodeWithDynamicTable()"]
  e6a8c78f_612c_a898_3946_dd974c0e8e72 -->|calls| e5dd0675_23b6_2e4d_161a_a83f05c006a9
  a8642bed_b3de_8bb7_a79f_f18b39f7cc89["add()"]
  e5dd0675_23b6_2e4d_161a_a83f05c006a9 -->|calls| a8642bed_b3de_8bb7_a79f_f18b39f7cc89
  42ffacf2_0327_c0cf_782a_13b619b56936["mayNotBlockStream()"]
  e5dd0675_23b6_2e4d_161a_a83f05c006a9 -->|calls| 42ffacf2_0327_c0cf_782a_13b619b56936
  07b6b4b6_0f8d_7e39_baf3_06035d82689b["encodePostBaseIndexed()"]
  e5dd0675_23b6_2e4d_161a_a83f05c006a9 -->|calls| 07b6b4b6_0f8d_7e39_baf3_06035d82689b
  4a1423e0_537b_7a93_4ca7_87c2b75fd5a3["encodeIndexedDynamicTable()"]
  e5dd0675_23b6_2e4d_161a_a83f05c006a9 -->|calls| 4a1423e0_537b_7a93_4ca7_87c2b75fd5a3
  ff05e54c_ab86_28f0_9c02_ca61844188a2["tryAddToDynamicTable()"]
  e5dd0675_23b6_2e4d_161a_a83f05c006a9 -->|calls| ff05e54c_ab86_28f0_9c02_ca61844188a2
  45a48cc9_9def_4229_4428_84db06ae7a83["encodeLiteralWithPostBaseNameRef()"]
  e5dd0675_23b6_2e4d_161a_a83f05c006a9 -->|calls| 45a48cc9_9def_4229_4428_84db06ae7a83
  31073f0d_d6bf_e361_71a1_5382822ea3ed["encodeLiteralWithNameRefDynamicTable()"]
  e5dd0675_23b6_2e4d_161a_a83f05c006a9 -->|calls| 31073f0d_d6bf_e361_71a1_5382822ea3ed
  style e5dd0675_23b6_2e4d_161a_a83f05c006a9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http3/src/main/java/io/netty/handler/codec/http3/QpackEncoder.java lines 284–335

    private int tryEncodeWithDynamicTable(QpackAttributes qpackAttributes, ByteBuf out, int base, CharSequence name,
                                          CharSequence value) {
        if (qpackAttributes.dynamicTableDisabled()) {
            return DYNAMIC_TABLE_ENCODE_NOT_POSSIBLE;
        }
        assert qpackAttributes.encoderStreamAvailable();
        final QuicStreamChannel encoderStream = qpackAttributes.encoderStream();

        int idx = dynamicTable.getEntryIndex(name, value);
        if (idx == QpackEncoderDynamicTable.NOT_FOUND) {
            return DYNAMIC_TABLE_ENCODE_NOT_DONE;
        }
        if (idx >= 0) {
            if (dynamicTable.requiresDuplication(idx, sizeOf(name, value))) {
                idx = dynamicTable.add(name, value, sizeOf(name, value));
                assert idx >= 0;
                // https://www.rfc-editor.org/rfc/rfc9204.html#section-4.3.4
                //  0   1   2   3   4   5   6   7
                // +---+---+---+---+---+---+---+---+
                // | 0 | 0 | 0 |    Index (5+)     |
                // +---+---+---+-------------------+
                ByteBuf duplicate = encoderStream.alloc().buffer(8);
                encodePrefixedInteger(duplicate, (byte) 0b0000_0000, 5,
                        dynamicTable.relativeIndexForEncoderInstructions(idx));
                closeOnFailure(encoderStream.writeAndFlush(duplicate));
                if (mayNotBlockStream()) {
                    // Add to the table but do not use the entry in the header block to avoid blocking.
                    return DYNAMIC_TABLE_ENCODE_NOT_POSSIBLE;
                }
            }
            if (idx >= base) {
                encodePostBaseIndexed(out, base, idx);
            } else {
                encodeIndexedDynamicTable(out, base, idx);
            }
        } else { // name match
            idx = -(idx + 1);
            int addIdx = tryAddToDynamicTable(qpackAttributes, false,
                    dynamicTable.relativeIndexForEncoderInstructions(idx), name, value);
            if (addIdx < 0) {
                return DYNAMIC_TABLE_ENCODE_NOT_POSSIBLE;
            }
            idx = addIdx;

            if (idx >= base) {
                encodeLiteralWithPostBaseNameRef(out, base, idx, value);
            } else {
                encodeLiteralWithNameRefDynamicTable(out, base, idx, value);
            }
        }
        return idx;
    }

Domain

Subdomains

Frequently Asked Questions

What does tryEncodeWithDynamicTable() do?
tryEncodeWithDynamicTable() is a function in the netty codebase, defined in codec-http3/src/main/java/io/netty/handler/codec/http3/QpackEncoder.java.
Where is tryEncodeWithDynamicTable() defined?
tryEncodeWithDynamicTable() is defined in codec-http3/src/main/java/io/netty/handler/codec/http3/QpackEncoder.java at line 284.
What does tryEncodeWithDynamicTable() call?
tryEncodeWithDynamicTable() calls 7 function(s): add, encodeIndexedDynamicTable, encodeLiteralWithNameRefDynamicTable, encodeLiteralWithPostBaseNameRef, encodePostBaseIndexed, mayNotBlockStream, tryAddToDynamicTable.
What calls tryEncodeWithDynamicTable()?
tryEncodeWithDynamicTable() is called by 2 function(s): encodeHeader, encodeWithDynamicTable.

Analyze Your Own Codebase

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

Try Supermodel Free