BOXED FUTURE: As of Nov 2023 the returned Future from this function was 58KB. This would get stored on the stack which is bad for runtime performance, and blow up our stack usage. Because of that we purposefully move this Future onto the heap (i.e. Box it).
(&mut self, mut cmd: Command)
| 115 | /// get stored on the stack which is bad for runtime performance, and blow up our stack usage. |
| 116 | /// Because of that we purposefully move this Future onto the heap (i.e. Box it). |
| 117 | pub(crate) fn handle_command(&mut self, mut cmd: Command) -> LocalBoxFuture<'_, ()> { |
| 118 | async move { |
| 119 | if let Some(session) = cmd.session_mut() { |
| 120 | session.apply_external_metadata_updates(); |
| 121 | } |
| 122 | match cmd { |
| 123 | Command::Startup { |
| 124 | tx, |
| 125 | user, |
| 126 | conn_id, |
| 127 | secret_key, |
| 128 | uuid, |
| 129 | client_ip, |
| 130 | application_name, |
| 131 | notice_tx, |
| 132 | } => { |
| 133 | // Note: We purposefully do not use a ClientTransmitter here because startup |
| 134 | // handles errors and cleanup of sessions itself. |
| 135 | self.handle_startup( |
| 136 | tx, |
| 137 | user, |
| 138 | conn_id, |
| 139 | secret_key, |
| 140 | uuid, |
| 141 | client_ip, |
| 142 | application_name, |
| 143 | notice_tx, |
| 144 | ) |
| 145 | .await; |
| 146 | } |
| 147 | |
| 148 | Command::AuthenticatePassword { |
| 149 | tx, |
| 150 | role_name, |
| 151 | password, |
| 152 | } => { |
| 153 | self.handle_authenticate_password(tx, role_name, password) |
| 154 | .await; |
| 155 | } |
| 156 | |
| 157 | Command::AuthenticateGetSASLChallenge { |
| 158 | tx, |
| 159 | role_name, |
| 160 | nonce, |
| 161 | } => { |
| 162 | self.handle_generate_sasl_challenge(tx, role_name, nonce) |
| 163 | .await; |
| 164 | } |
| 165 | |
| 166 | Command::AuthenticateVerifySASLProof { |
| 167 | tx, |
| 168 | role_name, |
| 169 | proof, |
| 170 | mock_hash, |
| 171 | auth_message, |
| 172 | } => { |
| 173 | self.handle_authenticate_verify_sasl_proof( |
| 174 | tx, |
no test coverage detected