@@ -24,6 +24,7 @@ import (
2424 "go.mongodb.org/mongo-driver/v2/x/mongo/driver"
2525 "go.mongodb.org/mongo-driver/v2/x/mongo/driver/description"
2626 "go.mongodb.org/mongo-driver/v2/x/mongo/driver/mnet"
27+ "go.mongodb.org/mongo-driver/v2/x/mongo/driver/session"
2728)
2829
2930// maxClientMetadataSize is the maximum size of the client metadata document
@@ -41,6 +42,7 @@ type Hello struct {
4142 compressors []string
4243 saslSupportedMechs string
4344 d driver.Deployment
45+ clock * session.ClusterClock
4446 speculativeAuth bsoncore.Document
4547 topologyVersion * description.TopologyVersion
4648 maxAwaitTimeMS * int64
@@ -67,6 +69,16 @@ func (h *Hello) AppName(appname string) *Hello {
6769 return h
6870}
6971
72+ // ClusterClock sets the cluster clock for this operation.
73+ func (h * Hello ) ClusterClock (clock * session.ClusterClock ) * Hello {
74+ if h == nil {
75+ h = new (Hello )
76+ }
77+
78+ h .clock = clock
79+ return h
80+ }
81+
7082// Compressors sets the compressors that can be used.
7183func (h * Hello ) Compressors (compressors []string ) * Hello {
7284 h .compressors = compressors
@@ -615,6 +627,7 @@ func isLegacyHandshake(srvAPI *driver.ServerAPIOptions, loadbalanced bool) bool
615627
616628func (h * Hello ) createOperation () driver.Operation {
617629 op := driver.Operation {
630+ Clock : h .clock ,
618631 CommandFn : h .command ,
619632 Database : "admin" ,
620633 Deployment : h .d ,
@@ -639,6 +652,7 @@ func (h *Hello) GetHandshakeInformation(ctx context.Context, _ address.Address,
639652 deployment := driver.SingleConnectionDeployment {C : conn }
640653
641654 op := driver.Operation {
655+ Clock : h .clock ,
642656 CommandFn : h .handshakeCommand ,
643657 Deployment : deployment ,
644658 Database : "admin" ,
0 commit comments