()
| 50 | * Returns a server selector that selects for writable servers |
| 51 | */ |
| 52 | export function writableServerSelector(): ServerSelector { |
| 53 | return function writableServer( |
| 54 | topologyDescription: TopologyDescription, |
| 55 | servers: ServerDescription[], |
| 56 | deprioritized: DeprioritizedServers |
| 57 | ): ServerDescription[] { |
| 58 | const eligibleServers = filterDeprioritized( |
| 59 | servers.filter(({ isWritable }) => isWritable), |
| 60 | deprioritized |
| 61 | ); |
| 62 | |
| 63 | return latencyWindowReducer(topologyDescription, eligibleServers); |
| 64 | }; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * The purpose of this selector is to select the same server, only |
no test coverage detected