Browse Source

A bit of docs

Evan Huus 12 years ago
parent
commit
8db695793d
2 changed files with 8 additions and 0 deletions
  1. 7 0
      errors.go
  2. 1 0
      message.go

+ 7 - 0
errors.go

@@ -1,5 +1,7 @@
 package kafka
 package kafka
 
 
+// The various errors that can be returned by the Kafka server.
+// See https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-ErrorCodes
 type KError int16
 type KError int16
 
 
 const (
 const (
@@ -63,12 +65,17 @@ func (err OutOfBrokers) Error() string {
 	return "kafka: Client has run out of available brokers to talk to. Is your cluster reachable?"
 	return "kafka: Client has run out of available brokers to talk to. Is your cluster reachable?"
 }
 }
 
 
+// Returned when there was an error encoding a Kafka packet. This can happen, for example,
+// if you try to encode a string over 2^15 characters in length, since Kafka's encoding rules do
+// not permit that.
 type EncodingError string
 type EncodingError string
 
 
 func (err EncodingError) Error() string {
 func (err EncodingError) Error() string {
 	return "kafka: Could not encode packet. " + string(err)
 	return "kafka: Could not encode packet. " + string(err)
 }
 }
 
 
+// Returned when there was an error decoding the Kafka server's response. Usually means that you've
+// connected to the wrong address.
 type DecodingError string
 type DecodingError string
 
 
 func (err DecodingError) Error() string {
 func (err DecodingError) Error() string {

+ 1 - 0
message.go

@@ -6,6 +6,7 @@ import (
 	"io/ioutil"
 	"io/ioutil"
 )
 )
 
 
+// The various compression codec recognized by Kafka in messages.
 type CompressionCodec int
 type CompressionCodec int
 
 
 const (
 const (