private Pair<K, ItemsImpl> readEntryIfKeyMatch(long logChunkId,
                                                 @NotNull K expectedKey) throws IOException {
    ChunkedAppendOnlyLog.LogChunk chunk = keyValuesLog.read(logChunkId);
    ByteBuffer chunkBuffer = chunk.read();
    int header = readHeader(chunkBuffer);
    int keyRecordSize = keySize(header);
    boolean valueIsAbsent = isValueAbsent(header);

    ByteBuffer keyRecordSlice = chunkBuffer.slice(Integer.BYTES, keyRecordSize)
      .order(chunkBuffer.order());
    K candidateKey = keyDescriptor.read(keyRecordSlice);
    if (!keyDescriptor.isEqual(expectedKey, candidateKey)) {
      return null;
    }

    if (valueIsAbsent) {
      return Pair.pair(expectedKey, null);
    }

    return Pair.pair(expectedKey, new ItemsImpl(chunk));
  }
private Pair<K, ItemsImpl> readEntryIfKeyMatch(long logChunkId,
                                                 @NotNull K expectedKey)