Browse Source

Don't export newSyncProducerFromProducer

It has to modify the config out from under the real producer, so it isn't really
safe to use except in the specific circumstances of the other two SyncProducer
constructors.
Evan Huus 10 years ago
parent
commit
3d6ab1332c
1 changed files with 3 additions and 4 deletions
  1. 3 4
      sync_producer.go

+ 3 - 4
sync_producer.go

@@ -16,7 +16,7 @@ func NewSyncProducer(addrs []string, config *Config) (*SyncProducer, error) {
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	return NewSyncProducerFromProducer(p), nil
+	return newSyncProducerFromProducer(p), nil
 }
 }
 
 
 // NewSyncProducerFromClient creates a new SyncProducer using the given client.
 // NewSyncProducerFromClient creates a new SyncProducer using the given client.
@@ -25,11 +25,10 @@ func NewSyncProducerFromClient(client *Client) (*SyncProducer, error) {
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	return NewSyncProducerFromProducer(p), nil
+	return newSyncProducerFromProducer(p), nil
 }
 }
 
 
-// NewSyncProducerFromProducer creates a new SyncProducer using the given producer as backing.
-func NewSyncProducerFromProducer(p *Producer) *SyncProducer {
+func newSyncProducerFromProducer(p *Producer) *SyncProducer {
 	p.conf.Producer.AckSuccesses = true
 	p.conf.Producer.AckSuccesses = true
 	sp := &SyncProducer{producer: p}
 	sp := &SyncProducer{producer: p}