Browse Source

Match names correctly

Evan Huus 12 years ago
parent
commit
0522caa404
2 changed files with 9 additions and 9 deletions
  1. 7 7
      consumer.go
  2. 2 2
      consumer_test.go

+ 7 - 7
consumer.go

@@ -4,12 +4,12 @@ package sarama
 type OffsetMethod int
 type OffsetMethod int
 
 
 const (
 const (
-	// METHOD_MANUAL causes the consumer to interpret the OffsetValue in the ConsumerConfig as the
+	// OFFSET_METHOD_MANUAL causes the consumer to interpret the OffsetValue in the ConsumerConfig as the
 	// offset at which to start, allowing the user to manually specify their desired starting offset.
 	// offset at which to start, allowing the user to manually specify their desired starting offset.
-	METHOD_MANUAL OffsetMethod = iota
-	// METHOD_NEWEST causes the consumer to start at the most recent available offset, as determined
-	// by querying the broker.
-	METHOD_NEWEST OffsetMethod = iota
+	OFFSET_METHOD_MANUAL OffsetMethod = iota
+	// OFFSET_METHOD_NEWEST causes the consumer to start at the most recent available offset, as
+	// determined by querying the broker.
+	OFFSET_METHOD_NEWEST OffsetMethod = iota
 )
 )
 
 
 // ConsumerConfig is used to pass multiple configuration options to NewConsumer.
 // ConsumerConfig is used to pass multiple configuration options to NewConsumer.
@@ -97,12 +97,12 @@ func NewConsumer(client *Client, topic string, partition int32, group string, co
 	c.broker = broker
 	c.broker = broker
 
 
 	switch config.OffsetMethod {
 	switch config.OffsetMethod {
-	case METHOD_MANUAL:
+	case OFFSET_METHOD_MANUAL:
 		if config.OffsetValue < 0 {
 		if config.OffsetValue < 0 {
 			return nil, ConfigurationError("OffsetValue cannot be < 0 when OffsetMethod is MANUAL")
 			return nil, ConfigurationError("OffsetValue cannot be < 0 when OffsetMethod is MANUAL")
 		}
 		}
 		c.offset = config.OffsetValue
 		c.offset = config.OffsetValue
-	case METHOD_NEWEST:
+	case OFFSET_METHOD_NEWEST:
 		c.offset, err = c.getLatestOffset(true)
 		c.offset, err = c.getLatestOffset(true)
 		if err != nil {
 		if err != nil {
 			return nil, err
 			return nil, err

+ 2 - 2
consumer_test.go

@@ -116,7 +116,7 @@ func TestConsumerRawOffset(t *testing.T) {
 	}
 	}
 	defer client.Close()
 	defer client.Close()
 
 
-	consumer, err := NewConsumer(client, "my_topic", 0, "my_consumer_group", &ConsumerConfig{OffsetMethod: METHOD_MANUAL, OffsetValue: 1234})
+	consumer, err := NewConsumer(client, "my_topic", 0, "my_consumer_group", &ConsumerConfig{OffsetMethod: OFFSET_METHOD_MANUAL, OffsetValue: 1234})
 	if err != nil {
 	if err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}
@@ -157,7 +157,7 @@ func TestConsumerLatestOffset(t *testing.T) {
 	}
 	}
 	defer client.Close()
 	defer client.Close()
 
 
-	consumer, err := NewConsumer(client, "my_topic", 0, "my_consumer_group", &ConsumerConfig{OffsetMethod: METHOD_NEWEST})
+	consumer, err := NewConsumer(client, "my_topic", 0, "my_consumer_group", &ConsumerConfig{OffsetMethod: OFFSET_METHOD_NEWEST})
 	if err != nil {
 	if err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}