Runs a GRV probe on the cluster to determine if the client version is compatible with the cluster. Must be called from main thread
| 2151 | // Runs a GRV probe on the cluster to determine if the client version is compatible with the cluster. |
| 2152 | // Must be called from main thread |
| 2153 | void MultiVersionDatabase::LegacyVersionMonitor::runGrvProbe(Reference<MultiVersionDatabase::DatabaseState> dbState) { |
| 2154 | tr = db->createTransaction(); |
| 2155 | Reference<LegacyVersionMonitor> self = Reference<LegacyVersionMonitor>::addRef(this); |
| 2156 | versionMonitor = mapThreadFuture<Version, Void>(tr->getReadVersion(), [self, dbState](ErrorOr<Version> v) { |
| 2157 | // If the version attempt returns an error, we regard that as a connection (except operation_cancelled) |
| 2158 | if (!v.isError() || v.getError().code() != error_code_operation_cancelled) { |
| 2159 | onMainThreadVoid([self, dbState]() { |
| 2160 | self->monitorRunning = false; |
| 2161 | dbState->protocolVersionChanged(self->client->protocolVersion); |
| 2162 | }); |
| 2163 | } |
| 2164 | |
| 2165 | return v.map<Void>([](Version v) { return Void(); }); |
| 2166 | }); |
| 2167 | } |
| 2168 | |
| 2169 | void MultiVersionDatabase::LegacyVersionMonitor::close() { |
| 2170 | if (versionMonitor.isValid()) { |
no test coverage detected