Skip to content

Commit

Permalink
rm zap from protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
travisjeffery committed Aug 6, 2018
1 parent 3be9d2f commit 8e8c59b
Show file tree
Hide file tree
Showing 51 changed files with 26 additions and 664 deletions.
39 changes: 13 additions & 26 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions jocko/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

"github.com/travisjeffery/jocko/protocol"
"go.uber.org/zap/zapcore"
)

type Context struct {
Expand Down Expand Up @@ -62,16 +61,3 @@ func (ctx *Context) Value(key interface{}) interface{} {
ctx.mu.Unlock()
return val
}

func (ctx *Context) MarshalLogObject(e zapcore.ObjectEncoder) error {
if ctx.header != nil {
e.AddObject("header", ctx.header)
}
if ctx.req != nil {
e.AddObject("request", ctx.req.(zapcore.ObjectMarshaler))
}
if ctx.res != nil {
e.AddObject("response", ctx.res.(zapcore.ObjectMarshaler))
}
return nil
}
8 changes: 0 additions & 8 deletions protocol/alter_configs_request.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

type AlterConfigsRequest struct {
APIVersion int16

Expand Down Expand Up @@ -93,7 +89,3 @@ func (r *AlterConfigsRequest) Key() int16 {
func (r *AlterConfigsRequest) Version() int16 {
return r.APIVersion
}

func (r *AlterConfigsRequest) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/alter_configs_response.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

import "time"

type AlterConfigsResponse struct {
Expand Down Expand Up @@ -70,7 +66,3 @@ func (r *AlterConfigsResponse) Decode(d PacketDecoder, version int16) (err error
func (r *AlterConfigsResponse) Version() int16 {
return r.APIVersion
}

func (r *AlterConfigsResponse) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/api_versions_requests.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

type APIVersionsRequest struct {
APIVersion int16
}
Expand All @@ -24,7 +20,3 @@ func (c *APIVersionsRequest) Key() int16 {
func (r *APIVersionsRequest) Version() int16 {
return r.APIVersion
}

func (r *APIVersionsRequest) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/api_versions_response.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

import "time"

type APIVersionsResponse struct {
Expand Down Expand Up @@ -79,7 +75,3 @@ func (c *APIVersionsResponse) Decode(d PacketDecoder, version int16) error {
func (r *APIVersionsResponse) Version() int16 {
return r.APIVersion
}

func (r *APIVersionsResponse) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/controlled_shutdown_request.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

type ControlledShutdownRequest struct {
Version int16
}
Expand All @@ -15,7 +11,3 @@ func (r *ControlledShutdownRequest) Encode(e PacketEncoder) (err error) {
func (r *ControlledShutdownRequest) Decode(d PacketDecoder, version int16) (err error) {
return nil
}

func (r *ControlledShutdownRequest) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/controlled_shutdown_response.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

type ControlledShutdownResponse struct {
APIVersion int16
}
Expand All @@ -21,7 +17,3 @@ func (r *ControlledShutdownResponse) Decode(d PacketDecoder, version int16) (err
func (r *ControlledShutdownResponse) Version() int16 {
return r.APIVersion
}

func (r *ControlledShutdownResponse) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
6 changes: 0 additions & 6 deletions protocol/create_topic_requests.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package protocol

import "go.uber.org/zap/zapcore"

type CreateTopicRequest struct {
Topic string
NumPartitions int32
Expand Down Expand Up @@ -141,7 +139,3 @@ func (c *CreateTopicRequests) Key() int16 {
func (r *CreateTopicRequests) Version() int16 {
return r.APIVersion
}

func (r *CreateTopicRequests) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/create_topics_response.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

import "time"

type TopicErrorCode struct {
Expand Down Expand Up @@ -82,7 +78,3 @@ func (c *CreateTopicsResponse) Decode(d PacketDecoder, version int16) error {
func (r *CreateTopicsResponse) Version() int16 {
return r.APIVersion
}

func (r *CreateTopicsResponse) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/delete_topic_request.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

type DeleteTopicsRequest struct {
APIVersion int16

Expand Down Expand Up @@ -36,7 +32,3 @@ func (c *DeleteTopicsRequest) Key() int16 {
func (r *DeleteTopicsRequest) Version() int16 {
return r.APIVersion
}

func (r *DeleteTopicsRequest) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/delete_topic_response.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

import "time"

type DeleteTopicsResponse struct {
Expand Down Expand Up @@ -59,7 +55,3 @@ func (c *DeleteTopicsResponse) Decode(d PacketDecoder, version int16) error {
func (r *DeleteTopicsResponse) Version() int16 {
return r.APIVersion
}

func (r *DeleteTopicsResponse) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/describe_configs_request.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

// https://kafka.apache.org/protocol#The_Messages_DescribeConfigs

type DescribeConfigsRequest struct {
Expand Down Expand Up @@ -73,7 +69,3 @@ func (r *DescribeConfigsRequest) Key() int16 {
func (r *DescribeConfigsRequest) Version() int16 {
return r.APIVersion
}

func (r *DescribeConfigsRequest) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/describe_configs_response.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

import "time"

type DescribeConfigsResponse struct {
Expand Down Expand Up @@ -163,7 +159,3 @@ func (r *DescribeConfigsResponse) Decode(d PacketDecoder, version int16) (err er
func (r *DescribeConfigsResponse) Version() int16 {
return r.APIVersion
}

func (r *DescribeConfigsResponse) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/describe_groups_request.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

type DescribeGroupsRequest struct {
APIVersion int16

Expand All @@ -27,7 +23,3 @@ func (r *DescribeGroupsRequest) Key() int16 {
func (r *DescribeGroupsRequest) Version() int16 {
return r.APIVersion
}

func (r *DescribeGroupsRequest) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
8 changes: 0 additions & 8 deletions protocol/describe_groups_response.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

import "time"

type DescribeGroupsResponse struct {
Expand Down Expand Up @@ -168,7 +164,3 @@ func (r *GroupMember) Decode(d PacketDecoder, version int16) (err error) {
}
return nil
}

func (r *DescribeGroupsResponse) MarshalLogObject(e zapcore.ObjectEncoder) error {
return nil
}
39 changes: 0 additions & 39 deletions protocol/fetch_request.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package protocol

import (
"go.uber.org/zap/zapcore"
)

type IsolationLevel int8

const (
Expand Down Expand Up @@ -140,41 +136,6 @@ func (r *FetchRequest) Version() int16 {
return r.APIVersion
}

func (r *FetchRequest) MarshalLogObject(e zapcore.ObjectEncoder) error {
e.AddInt32("replica id", r.ReplicaID)
e.AddInt32("min bytes", r.MinBytes)
e.AddInt32("max bytes", r.MaxBytes)
e.AddArray("topic", FetchTopics(r.Topics))
return nil
}

func (f *FetchPartition) MarshalLogObject(e zapcore.ObjectEncoder) error {
e.AddInt32("partition", f.Partition)
e.AddInt64("fetch offset", f.FetchOffset)
e.AddInt32("max bytes", f.MaxBytes)
return nil
}

type FetchPartitions []*FetchPartition

func (f FetchPartitions) MarshalLogArray(e zapcore.ArrayEncoder) error {
for _, t := range f {
e.AppendObject(t)
}
return nil
}

func (f *FetchTopic) MarshalLogObject(e zapcore.ObjectEncoder) error {
e.AddString("topic", f.Topic)
e.AddArray("partitions", FetchPartitions(f.Partitions))
return nil
}

type FetchTopics []*FetchTopic

func (f FetchTopics) MarshalLogArray(e zapcore.ArrayEncoder) error {
for _, t := range f {
e.AppendObject(t)
}
return nil
}
Loading

0 comments on commit 8e8c59b

Please sign in to comment.