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
Open
prestonvasquez
wants to merge
4
commits into
mongodb:master
Choose a base branch
from
prestonvasquez:GODRIVER-2965
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (C) MongoDB, Inc. 2024-present. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. You may obtain | ||
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
package event | ||
|
||
import ( | ||
"time" | ||
|
||
"go.mongodb.org/mongo-driver/bson" | ||
"go.mongodb.org/mongo-driver/mongo/address" | ||
"go.mongodb.org/mongo-driver/tag" | ||
) | ||
|
||
// ServerDescription contains information about a node in a cluster. This is | ||
// 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 { | ||
Addr address.Address | ||
Arbiters []string | ||
Compression []string // compression methods returned by server | ||
CanonicalAddr address.Address | ||
ElectionID bson.ObjectID | ||
IsCryptd bool | ||
HelloOK bool | ||
Hosts []string | ||
Kind string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
} |
||
LastWriteTime time.Time | ||
MaxBatchCount uint32 | ||
MaxDocumentSize uint32 | ||
MaxMessageSize uint32 | ||
MaxWireVersion int32 | ||
MinWireVersion int32 | ||
Members []address.Address | ||
Passives []string | ||
Passive bool | ||
Primary address.Address | ||
ReadOnly bool | ||
ServiceID *bson.ObjectID // Only set for servers that are deployed behind a load balancer. | ||
SessionTimeoutMinutes *int64 | ||
SetName string | ||
SetVersion uint32 | ||
Tags tag.Set | ||
TopologyVersionProcessID bson.ObjectID | ||
TopologyVersionCounter int64 | ||
} | ||
|
||
// TopologyDescription contains information about a MongoDB cluster. | ||
type TopologyDescription struct { | ||
Servers []ServerDescription | ||
SetName string | ||
Kind string | ||
SessionTimeoutMinutes *int64 | ||
CompatibilityErr error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
.