فهرست منبع

Publish and document RequestEncoder interface type

It's internal, but it's a necessarily public type for anyone sending to a
broker. All public types are now consistent (ie they don't take parameters that
are private types, or any such things).
Evan Huus 12 سال پیش
والد
کامیت
d26d2f1b52
2فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  1. 1 1
      broker.go
  2. 4 2
      request.go

+ 1 - 1
broker.go

@@ -70,7 +70,7 @@ func (b *Broker) Close() error {
 	return b.conn.Close()
 }
 
-func (b *Broker) Send(clientID *string, req requestEncoder) (decoder, error) {
+func (b *Broker) Send(clientID *string, req RequestEncoder) (interface{}, error) {
 	fullRequest := request{b.correlation_id, clientID, req}
 	packet, err := encode(&fullRequest)
 	if err != nil {

+ 4 - 2
request.go

@@ -1,6 +1,8 @@
 package kafka
 
-type requestEncoder interface {
+// An internal interface satisfied by all of the Request structures
+// (MetadataRequest, ProduceRequest, etc).
+type RequestEncoder interface {
 	encoder
 	key() int16
 	version() int16
@@ -10,7 +12,7 @@ type requestEncoder interface {
 type request struct {
 	correlation_id int32
 	id             *string
-	body           requestEncoder
+	body           RequestEncoder
 }
 
 func (r *request) encode(pe packetEncoder) {