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
GODRIVER-2965 Internalize description package #1621
base: master
Are you sure you want to change the base?
Conversation
API Change Report./eventincompatible changes##ServerDescriptionChangedEvent.NewDescription: changed from ./mongo/description.Server to ServerDescription compatible changesServerDescription: added ./mongo/descriptionincompatible changespackage removed ./x/mongo/driverincompatible changes##CursorResponse.Desc: changed from ./mongo/description.Server to ./x/mongo/driver/description.Server ./x/mongo/driver/authincompatible changes##HandshakeOptions.PerformAuthentication: changed from func(./mongo/description.Server) bool to func(./x/mongo/driver/description.Server) bool ./x/mongo/driver/descriptioncompatible changespackage added ./x/mongo/driver/drivertestincompatible changes##(*ChannelConn).Description: changed from func() ./mongo/description.Server to func() ./x/mongo/driver/description.Server ./x/mongo/driver/mnetincompatible changes##Describer.Description: changed from func() ./mongo/description.Server to func() ./x/mongo/driver/description.Server ./x/mongo/driver/operationincompatible changes##(*AbortTransaction).ServerSelector: changed from func(./mongo/description.ServerSelector) *AbortTransaction to func(./x/mongo/driver/description.ServerSelector) *AbortTransaction ./x/mongo/driver/sessionincompatible changes##(*Client).ApplyCommand: changed from func(./mongo/description.Server) error to func(./x/mongo/driver/description.Server) error compatible changesClient.PinnedServerAddr: added ./x/mongo/driver/topologyincompatible changes##(*Connection).Description: changed from func() ./mongo/description.Server to func() ./x/mongo/driver/description.Server |
// created from hello command responses. If the value of the Kind field is | ||
// LoadBalancer, only the Addr and Kind fields will be set. All other fields | ||
// will be set to the zero value of the field's type. | ||
type ServerDescription struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ServerDescription holds data from the handshake, parsed from driverutil.NewDescriptionServer
.
IsCryptd bool | ||
HelloOK bool | ||
Hosts []string | ||
Kind string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return a string that can be compared to the the enumeration in the experimental description package. E.g:
if strings.ToLower(server.Kind) == strings.ToLower(description.ServerKindMongos.String()) {
// Do something
}
@@ -116,7 +117,7 @@ type Client struct { | |||
|
|||
pool *Pool | |||
TransactionState TransactionState | |||
PinnedServer *description.Server | |||
PinnedServerAddr *address.Address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only value used on PinnedServer
is the address.
GODRIVER-2965
Summary
Internalize the logic in the description package.
Background & Motivation
Most of the "description" package does not need to be part of the public API. The few parts that do can be merged into the most appropriate package(s).