Repository: kafka Updated Branches: refs/heads/0.8.2 db0d76b5d -> 1ac8df1d3
kafka-1644; Inherit FetchResponse from RequestOrResponse; patched by Anton Karamanov; reviewed by Jun Rao Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/1ac8df1d Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/1ac8df1d Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/1ac8df1d Branch: refs/heads/0.8.2 Commit: 1ac8df1d32597dca8e0f3537df051b4f787879ea Parents: db0d76b Author: Anton Karamanov <[email protected]> Authored: Thu Oct 9 08:39:42 2014 -0700 Committer: Jun Rao <[email protected]> Committed: Thu Oct 9 08:39:42 2014 -0700 ---------------------------------------------------------------------- core/src/main/scala/kafka/api/FetchResponse.scala | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/1ac8df1d/core/src/main/scala/kafka/api/FetchResponse.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/kafka/api/FetchResponse.scala b/core/src/main/scala/kafka/api/FetchResponse.scala index af93087..8d085a1 100644 --- a/core/src/main/scala/kafka/api/FetchResponse.scala +++ b/core/src/main/scala/kafka/api/FetchResponse.scala @@ -152,7 +152,8 @@ object FetchResponse { case class FetchResponse(correlationId: Int, - data: Map[TopicAndPartition, FetchResponsePartitionData]) { + data: Map[TopicAndPartition, FetchResponsePartitionData]) + extends RequestOrResponse() { /** * Partitions the data into a map of maps (one for each topic). @@ -168,6 +169,16 @@ case class FetchResponse(correlationId: Int, folded + topicData.sizeInBytes }) + /* + * FetchResponse uses [sendfile](http://man7.org/linux/man-pages/man2/sendfile.2.html) + * api for data transfer, so `writeTo` aren't actually being used. + * It is implemented as an empty function to comform to `RequestOrResponse.writeTo` + * abstract method signature. + */ + def writeTo(buffer: ByteBuffer): Unit = throw new UnsupportedOperationException + + override def describe(details: Boolean): String = toString + private def partitionDataFor(topic: String, partition: Int): FetchResponsePartitionData = { val topicAndPartition = TopicAndPartition(topic, partition) data.get(topicAndPartition) match {
