Repository: kafka
Updated Branches:
refs/heads/trunk 1a6c9207c -> 68b9f7716
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/68b9f771
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/68b9f771
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/68b9f771
Branch: refs/heads/trunk
Commit: 68b9f7716df1d994a9d43bec6bc42c90e66f1e99
Parents: 1a6c920
Author: Anton Karamanov <ataraxer@gmail.com>
Authored: Tue Oct 7 18:22:31 2014 -0700
Committer: Jun Rao <junrao@gmail.com>
Committed: Tue Oct 7 18:22:31 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/68b9f771/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 {
|