github.com/mdaxf/iac@v0.0.0-20240519030858-58a061660378/vendor_skip/go.mongodb.org/mongo-driver/mongo/change_stream_deployment.go (about) 1 // Copyright (C) MongoDB, Inc. 2017-present. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may 4 // not use this file except in compliance with the License. You may obtain 5 // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 7 package mongo 8 9 import ( 10 "context" 11 12 "go.mongodb.org/mongo-driver/mongo/description" 13 "go.mongodb.org/mongo-driver/x/mongo/driver" 14 ) 15 16 type changeStreamDeployment struct { 17 topologyKind description.TopologyKind 18 server driver.Server 19 conn driver.Connection 20 } 21 22 var _ driver.Deployment = (*changeStreamDeployment)(nil) 23 var _ driver.Server = (*changeStreamDeployment)(nil) 24 var _ driver.ErrorProcessor = (*changeStreamDeployment)(nil) 25 26 func (c *changeStreamDeployment) SelectServer(context.Context, description.ServerSelector) (driver.Server, error) { 27 return c, nil 28 } 29 30 func (c *changeStreamDeployment) Kind() description.TopologyKind { 31 return c.topologyKind 32 } 33 34 func (c *changeStreamDeployment) Connection(context.Context) (driver.Connection, error) { 35 return c.conn, nil 36 } 37 38 func (c *changeStreamDeployment) RTTMonitor() driver.RTTMonitor { 39 return c.server.RTTMonitor() 40 } 41 42 func (c *changeStreamDeployment) ProcessError(err error, conn driver.Connection) driver.ProcessErrorResult { 43 ep, ok := c.server.(driver.ErrorProcessor) 44 if !ok { 45 return driver.NoChange 46 } 47 48 return ep.ProcessError(err, conn) 49 }