pub enum Action {
WriteAndReadByte,
ReadMessage,
Write,
WriteAndReadMessage,
TlsHandshake,
HandleAsyncMessageAndReadMessage(AsyncMessage),
Finished,
}Expand description
Action requested by a state machine.
The caller should perform the requested I/O and then call the appropriate method to continue the state machine.
Variants§
WriteAndReadByte
Write buffer_set.write_buffer to the server, then read a single byte.
Used for SSL negotiation: write SSL request, then read response (‘S’ or ‘N’).
ReadMessage
Read a PostgreSQL message from the server.
The caller should:
- Read the message type byte (1 byte)
- Read the length (4 bytes, big-endian i32)
- Read (length - 4) bytes of payload into the buffer set
- Call the state machine’s
step()method again
Write
Write buffer_set.write_buffer to the server.
The caller should write all bytes to the socket and flush,
then call step() again.
WriteAndReadMessage
Write buffer_set.write_buffer to the server, then read a message.
Used for query operations: write query, then read response.
TlsHandshake
Perform TLS handshake.
After successful handshake, call step() again.
HandleAsyncMessageAndReadMessage(AsyncMessage)
An asynchronous message was received.
The caller should handle the message, read the next message,
then call step() again.
Finished
The state machine has finished successfully.