Skip to content

Commit 28e68f8

Browse files
author
Divjot Arora
committed
rename Streamer to StreamerConnection
1 parent ca0a6d1 commit 28e68f8

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

x/mongo/driver/driver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ type Expirable interface {
6565
Alive() bool
6666
}
6767

68-
// Streamer represents a Connection that supports streaming wire protocol messages using the moreToCome and
68+
// StreamerConnection represents a Connection that supports streaming wire protocol messages using the moreToCome and
6969
// exhaustAllowed flags.
7070
//
7171
// The SetStreaming and CurrentlyStreaming functions correspond to the moreToCome flag on server responses. If a
7272
// response has moreToCome set, SetStreaming(true) will be called and CurrentlyStreaming() should return true.
7373
//
7474
// CanStream corresponds to the exhaustAllowed flag. The operations layer will set exhaustAllowed on outgoing wire
7575
// messages to inform the server that the driver supports streaming.
76-
type Streamer interface {
76+
type StreamerConnection interface {
7777
Connection
7878
SetStreaming(bool)
7979
CurrentlyStreaming() bool
80-
CanStream() bool
80+
SupportsStreaming() bool
8181
}
8282

8383
// Compressor is an interface used to compress wire messages. If a Connection supports compression

x/mongo/driver/operation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ func (op Operation) readWireMessage(ctx context.Context, conn Connection, wm []b
613613

614614
// If the server replied with moreToCome set, the connection should be marked as "streaming".
615615
if wiremessage.IsMsgMoreToCome(wm) {
616-
if streamer, ok := conn.(Streamer); ok {
616+
if streamer, ok := conn.(StreamerConnection); ok {
617617
streamer.SetStreaming(true)
618618
}
619619
}
@@ -790,7 +790,7 @@ func (op Operation) createMsgWireMessage(ctx context.Context, dst []byte, desc d
790790
}
791791
// Set the ExhaustAllowed flag if the connection supports streaming. This will tell the server that it can
792792
// respond with the MoreToCome flag and then stream responses over this connection.
793-
if streamer, ok := conn.(Streamer); ok && streamer.CanStream() {
793+
if streamer, ok := conn.(StreamerConnection); ok && streamer.SupportsStreaming() {
794794
flags |= wiremessage.ExhaustAllowed
795795
}
796796

x/mongo/driver/operation_exhaust.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
// ExecuteExhaust gets a connection from the provided deployment and reads a response from it. This will error if the
1717
// connection CurrentlyStreaming function returns false.
18-
func (op Operation) ExecuteExhaust(ctx context.Context, conn Streamer, scratch []byte) error {
18+
func (op Operation) ExecuteExhaust(ctx context.Context, conn StreamerConnection, scratch []byte) error {
1919
if !conn.CurrentlyStreaming() {
2020
return errors.New("exhaust read must be done with a Streamer that is currently streaming")
2121
}

x/mongo/driver/operation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ func (m *mockConnection) Description() description.Server { return m.rDesc }
657657
func (m *mockConnection) Close() error { return m.rCloseErr }
658658
func (m *mockConnection) ID() string { return m.rID }
659659
func (m *mockConnection) Address() address.Address { return m.rAddr }
660-
func (m *mockConnection) CanStream() bool { return m.rCanStream }
660+
func (m *mockConnection) SupportsStreaming() bool { return m.rCanStream }
661661
func (m *mockConnection) CurrentlyStreaming() bool { return m.rStreaming }
662662
func (m *mockConnection) SetStreaming(streaming bool) { m.rStreaming = streaming }
663663

x/mongo/driver/topology/connection.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func (c *connection) bumpIdleDeadline() {
341341
type initConnection struct{ *connection }
342342

343343
var _ driver.Connection = initConnection{}
344-
var _ driver.Streamer = initConnection{}
344+
var _ driver.StreamerConnection = initConnection{}
345345

346346
func (c initConnection) Description() description.Server {
347347
if c.connection == nil {
@@ -370,7 +370,7 @@ func (c initConnection) SetStreaming(streaming bool) {
370370
func (c initConnection) CurrentlyStreaming() bool {
371371
return c.currentlyStreaming
372372
}
373-
func (c initConnection) CanStream() bool {
373+
func (c initConnection) SupportsStreaming() bool {
374374
return c.canStream
375375
}
376376

0 commit comments

Comments
 (0)