github.com/hack0072008/kafka-go@v1.0.1/protocol/offsetfetch/offsetfetch.go (about)

     1  package offsetfetch
     2  
     3  import "github.com/hack0072008/kafka-go/protocol"
     4  
     5  func init() {
     6  	protocol.Register(&Request{}, &Response{})
     7  }
     8  
     9  type Request struct {
    10  	GroupID string         `kafka:"min=v0,max=v5"`
    11  	Topics  []RequestTopic `kafka:"min=v0,max=v5"`
    12  }
    13  
    14  func (r *Request) ApiKey() protocol.ApiKey { return protocol.OffsetFetch }
    15  
    16  func (r *Request) Group() string { return r.GroupID }
    17  
    18  type RequestTopic struct {
    19  	Name             string  `kafka:"min=v0,max=v5"`
    20  	PartitionIndexes []int32 `kafka:"min=v0,max=v5"`
    21  }
    22  
    23  var (
    24  	_ protocol.GroupMessage = (*Request)(nil)
    25  )
    26  
    27  type Response struct {
    28  	ThrottleTimeMs int32           `kafka:"min=v3,max=v5"`
    29  	Topics         []ResponseTopic `kafka:"min=v0,max=v5"`
    30  	ErrorCode      int16           `kafka:"min=v2,max=v5"`
    31  }
    32  
    33  func (r *Response) ApiKey() protocol.ApiKey { return protocol.OffsetFetch }
    34  
    35  type ResponseTopic struct {
    36  	Name       string              `kafka:"min=v0,max=v5"`
    37  	Partitions []ResponsePartition `kafka:"min=v0,max=v5"`
    38  }
    39  
    40  type ResponsePartition struct {
    41  	PartitionIndex      int32  `kafka:"min=v0,max=v5"`
    42  	CommittedOffset     int64  `kafka:"min=v0,max=v5"`
    43  	ComittedLeaderEpoch int32  `kafka:"min=v5,max=v5"`
    44  	Metadata            string `kafka:"min=v0,max=v5,nullable"`
    45  	ErrorCode           int16  `kafka:"min=v0,max=v5"`
    46  }