Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

streaming: Unembed iface.Private in streaming-based interfaces #533

Merged
merged 2 commits into from
Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions internal/iface/iface.go

This file was deleted.

5 changes: 1 addition & 4 deletions protocol/binary/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"fmt"
"io"

"go.uber.org/thriftrw/internal/iface"
"go.uber.org/thriftrw/protocol/envelope"
"go.uber.org/thriftrw/protocol/stream"
"go.uber.org/thriftrw/wire"
Expand All @@ -36,9 +35,7 @@ import (
var Default = new(Protocol)

// Protocol implements the Thrift Binary Protocol.
type Protocol struct {
iface.Private
}
type Protocol struct{}

var _ stream.Protocol = (*Protocol)(nil)
var _ stream.RequestReader = (*Protocol)(nil)
Expand Down
3 changes: 0 additions & 3 deletions protocol/binary/stream_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"math"
"sync"

"go.uber.org/thriftrw/internal/iface"
"go.uber.org/thriftrw/protocol/stream"
"go.uber.org/thriftrw/wire"
)
Expand Down Expand Up @@ -62,8 +61,6 @@ func fixedWidth(t wire.Type) int64 {

// StreamReader provides an implementation of a "stream.Reader".
type StreamReader struct {
iface.Private

reader io.Reader
buffer [8]byte

Expand Down
4 changes: 0 additions & 4 deletions protocol/binary/stream_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"math"
"sync"

"go.uber.org/thriftrw/internal/iface"
"go.uber.org/thriftrw/protocol/stream"
)

Expand All @@ -37,9 +36,6 @@ var streamWriterPool = sync.Pool{
// StreamWriter implements basic logic for writing the Thrift Binary Protocol
// to an io.Writer.
type StreamWriter struct {
// Private implementation to satisfy the private Writer interface.
iface.Impl

writer io.Writer

// This buffer is re-used every time we need a slice of up to 8 bytes.
Expand Down
7 changes: 0 additions & 7 deletions protocol/stream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ package stream
import (
"io"

"go.uber.org/thriftrw/internal/iface"
"go.uber.org/thriftrw/wire"
)

// Protocol defines a specific way for a Thrift value to be encoded or
// decoded, implemented in a streaming fashion.
type Protocol interface {
iface.Private // this interface is meant for internal implementations only

// Writer returns a streaming implementation of an encoder for a
// Thrift value.
Writer(w io.Writer) Writer
Expand Down Expand Up @@ -84,8 +81,6 @@ type ListHeader struct {
// Writer defines an encoder for a Thrift value, implemented in a streaming
// fashion.
type Writer interface {
iface.Private // this interface is meant for internal implementations only

WriteBool(b bool) error
WriteInt8(i int8) error
WriteInt16(i int16) error
Expand Down Expand Up @@ -114,8 +109,6 @@ type Writer interface {
// Reader defines an decoder for a Thrift value, implemented in a streaming
// fashion.
type Reader interface {
iface.Private // this interface is meant for internal implementations only

ReadBool() (bool, error)
ReadInt8() (int8, error)
ReadInt16() (int16, error)
Expand Down
36 changes: 0 additions & 36 deletions thrifttest/streamtest/mock_stream.go

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