Replies: 3 comments 1 reply
-
UPDATE
struct Execute {
// Message type ('O').
uint8 mtype = 0x4f;
// Length of message contents in bytes,
// including self.
uint32 message_length;
// A set of message headers.
uint16 num_headers;
Header headers[num_headers];
// Data I/O format.
uint8<IOFormat> io_format;
// Expected result cardinality.
uint8<Cardinality> expected_cardinality;
// Command text.
string command_text;
// Argument data descriptor ID.
uuid input_typedesc_id;
// Output data descriptor ID.
uuid output_typedesc_id;
+
+ // Session state descriptor ID.
+ uuid state_typedesc_id;
// Encoded argument data.
bytes arguments;
+
+ // Encoded state data.
+ bytes state_data;
};
|
Beta Was this translation helpful? Give feedback.
-
UPDATE 2State is still needed in struct Parse {
// Message type ('P').
uint8 mtype = 0x50;
// Length of message contents in bytes,
// including self.
uint32 message_length;
// A set of message headers.
uint16 num_headers;
Header headers[num_headers];
// A bit mask of allowed capabilities.
uint64<Capability> allowed_capabilities;
// A bit mask of query options.
uint64<CompilationFlag> compilation_flags;
// Implicit LIMIT clause on returned sets.
uint64 implicit_limit;
// Data output format.
uint8<OutputFormat> output_format;
// Expected result cardinality.
uint8<Cardinality> expected_cardinality;
// Command text.
string command_text;
+
+ // State data descriptor ID.
+ uuid state_typedesc_id;
+
+ // Encoded state data.
+ bytes state_data;
};
struct Execute {
// Message type ('O').
uint8 mtype = 0x4f;
// Length of message contents in bytes,
// including self.
uint32 message_length;
// A set of message headers.
uint16 num_headers;
Header headers[num_headers];
// A bit mask of allowed capabilities.
uint64<Capability> allowed_capabilities;
// A bit mask of query options.
uint64<CompilationFlag> compilation_flags;
// Implicit LIMIT clause on returned sets.
uint64 implicit_limit;
// Data output format.
uint8<OutputFormat> output_format;
// Expected result cardinality.
uint8<Cardinality> expected_cardinality;
// Command text.
string command_text;
+
+ // State data descriptor ID.
+ uuid state_typedesc_id;
+
+ // Encoded state data.
+ bytes state_data;
// Argument data descriptor ID.
uuid input_typedesc_id;
// Output data descriptor ID.
uuid output_typedesc_id;
// Encoded argument data.
bytes arguments;
}; |
Beta Was this translation helpful? Give feedback.
-
UPDATE 3We would like to drop the asynchronous We will add a new message This message will be sent when: 1.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is superseded by #4009.
Server Notifications of Session State Type
On connection, the server will send a
ParameterStatusmessage with namesession_state_description, and value as described in:The same
ParameterStatusmessage will also be pushed to all active connections when an DDL command that affects the session state type is applied successfully, like acreate globalcommand.Theoretically the client could use this message to build encoders/decoders so as to read or manipulate the session state, but the official client bindings are not yet doing anything with this message.
Server Responses with Session State
All server
CommandCompletemessages will send two extra fields as the most recent session state:struct CommandComplete { // Message type ('C'). uint8 mtype = 0x43; // Length of message contents in bytes, // including self. uint32 message_length; // A set of message headers. uint16 num_headers; Header headers[num_headers]; // Command status. string status; + + // Updated session state descriptor ID. + uuid state_typedesc_id; + + // Encoded session state data array. The array is + // currently always of size 1. + uint16 num_state_data; + DataElement state_data[num_state_data]; }; struct DataElement { // Encoded output data. uint32 num_data; uint8 data[num_data]; };The exact encoding of
DataElement.datais defined by the session state type descriptor. The session state is a free object like this:The client is supposed to store (overwrite if exist) the
state_typedesc_idandstate_dataper connection, and sends them together with the nextParseorExecutemessage, please see below.When a DDL command is successfully applied, it may modify session state fields that already have data in the current session, for example:
In this case, instead of returning
CommandComplete, the server will instead return a new message:error_codeis set to a new error typeStateSerializationError. This message means the DDL command is applied successfully, but the state cannot be serialized. The client could either choose to drop the connection (official client binding behavior), or update the state according to the type descriptor in theParameterStatusmessage and move on.Client Requests with Session State
The client will send two extra fields in messages
ParseandExecute:struct Parse { // Message type ('P'). uint8 mtype = 0x50; // Length of message contents in bytes, // including self. uint32 message_length; // A set of message headers. uint16 num_headers; Header headers[num_headers]; // Data I/O format. uint8<IOFormat> io_format; // Expected result cardinality uint8<Cardinality> expected_cardinality; // Command text. string command; + + // Session state descriptor ID. + uuid state_typedesc_id; + + // Encoded session state data array. The array is + // currently always of size 1. + uint16 num_state_data; + DataElement state_data[num_state_data]; }; struct Execute { // Message type ('O'). uint8 mtype = 0x4f; // Length of message contents in bytes, // including self. uint32 message_length; // A set of message headers. uint16 num_headers; Header headers[num_headers]; // Data I/O format. uint8<IOFormat> io_format; // Expected result cardinality. uint8<Cardinality> expected_cardinality; // Command text. string command_text; + + // Session state descriptor ID. + uuid state_typedesc_id; + + // Encoded session state data array. The array is + // currently always of size 1. + uint16 num_state_data; + DataElement state_data[num_state_data]; // Argument data descriptor ID. uuid input_typedesc_id; // Output data descriptor ID. uuid output_typedesc_id; // Encoded argument data. bytes arguments; };state_typedesc_idandstate_datashould be set to the most recently received state data from the server inCommandCompletemessages. In case when the client doesn't have a stored state, or doesn't want to send a message with state data,state_typedesc_idcan be set to a special ID of zero:00000000-0000-0000-0000-000000000000, indicating an empty/default state.On receiving these messages, the server would check the
state_typedesc_idagainst the current one of the current database. On mismatch, the server will send anErrorResponsemessage with a new error type:StateMismatchError. The client is safe to retry with an updated state, or simply drop the connection with an error (current official client bindings behavior).Capabilities in Official Client Bindings
The client bindings shall provide
withGlobals()API for setting globals. At the same time, EdgeQL commandSET GLOBALshould be forbidden in official client bindings. In RFC 1010,set globalrequires the capabilitysession config, but that is also used byconfigure sessioncommands. So we'd probably need a new capability forset globalandreset globalcommands, likesession globalor so.Beta Was this translation helpful? Give feedback.
All reactions