浏览代码

Move PartitionerConstructor definition into partitioner.go

Evan Huus 11 年之前
父节点
当前提交
e530ebdc9f
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 3 0
      partitioner.go
  2. 0 3
      producer.go

+ 3 - 0
partitioner.go

@@ -14,6 +14,9 @@ type Partitioner interface {
 	Partition(key Encoder, numPartitions int32) int32
 }
 
+// PartitionerConstructor is the type for a function capable of constructing new Partitioners.
+type PartitionerConstructor func() Partitioner
+
 // RandomPartitioner implements the Partitioner interface by choosing a random partition each time.
 type RandomPartitioner struct {
 	generator *rand.Rand

+ 0 - 3
producer.go

@@ -10,9 +10,6 @@ func forceFlushThreshold() int {
 	return int(MaxRequestSize - (10 * 1024)) // 10KiB is safety room for misc. overhead, we might want to calculate this more precisely?
 }
 
-// PartitionerConstructor is the type for a function capable of constructing new Partitioners.
-type PartitionerConstructor func() Partitioner
-
 // ProducerConfig is used to pass multiple configuration options to NewProducer.
 type ProducerConfig struct {
 	Partitioner       PartitionerConstructor // Generates partitioners for choosing the partition to send messages to (defaults to hash).