Explorar el Código

Update godoc for OffsetOldest and OffsetNewest, and move these to client.go.

Willem van Bergen hace 11 años
padre
commit
47bfe4df50
Se han modificado 2 ficheros con 11 adiciones y 9 borrados
  1. 11 0
      client.go
  2. 0 9
      consumer.go

+ 11 - 0
client.go

@@ -56,6 +56,17 @@ type Client interface {
 	Closed() bool
 }
 
+const (
+	// OffsetNewest stands for the log head offset, i.e. the offset that will be assigned to the next message
+	// that will be produced to the partition. You can send this to a client's GetOffset method to get this
+	// offset, or when calling ConsumePartition to start consuming new messages.
+	OffsetNewest int64 = -1
+	// OffsetOldest stands for the oldest offset available on the broker for a partition. You can send this
+	// to a client's GetOffset method to get this offset, or when calling ConsumePartition to start consuming
+	// from the oldest offset that is still available on the broker.
+	OffsetOldest int64 = -2
+)
+
 type client struct {
 	conf   *Config
 	closer chan none

+ 0 - 9
consumer.go

@@ -97,15 +97,6 @@ func (c *consumer) Close() error {
 	return nil
 }
 
-const (
-	// OffsetNewest causes the consumer to start at the most recent available offset, as
-	// determined by querying the broker.
-	OffsetNewest int64 = -1
-	// OffsetOldest causes the consumer to start at the oldest available offset, as
-	// determined by querying the broker.
-	OffsetOldest int64 = -2
-)
-
 func (c *consumer) ConsumePartition(topic string, partition int32, offset int64) (PartitionConsumer, error) {
 	child := &partitionConsumer{
 		consumer:  c,