Skip to content

Commit

Permalink
Bump edgedb-protocol for protocol v2 support (#1388)
Browse files Browse the repository at this point in the history
  • Loading branch information
elprans authored Nov 1, 2024
1 parent 290579b commit 4e7988a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 18 deletions.
11 changes: 6 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ rexpect = {git="https://github.com/tailhook/rexpect", branch="default_terminal_s
openssl-sys = {version="0.9.104", features=["vendored"]}

[profile.dev]
opt-level = 2 # 1 -- needed so windows don't get stack overflow, 2 - for GHA
opt-level = 0

[profile.release]
debug = true
Expand Down
10 changes: 7 additions & 3 deletions src/commands/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ pub async fn configure(
C::Set(Set {
parameter: S::ApplyAccessPolicies(ConfigStr { value }),
}) => set(cli, "apply_access_policies", None, value).await,
C::Set(Set {
parameter: S::ApplyAccessPoliciesSQL(ConfigStr { value }),
}) => set(cli, "apply_access_policies_sql", None, value).await,
C::Set(Set {
parameter: S::AllowUserSpecifiedId(ConfigStr { value }),
}) => set(cli, "allow_user_specified_id", None, value).await,
Expand Down Expand Up @@ -195,8 +198,8 @@ pub async fn configure(
parameter: S::StoreMigrationSdl(ConfigStr { value }),
}) => set(cli, "store_migration_sdl", None, format!("'{value}'")).await,
C::Set(Set {
parameter: S::NetHttpMaxConnections(ConfigStr { value }),
}) => set(cli, "net_http_max_connections", None, value).await,
parameter: S::HttpMaxConnections(ConfigStr { value }),
}) => set(cli, "http_max_connections", None, value).await,
C::Set(Set {
parameter: S::SimpleScoping(ConfigStr { value }),
}) => set(cli, "simple_scoping", None, value).await,
Expand All @@ -220,12 +223,13 @@ pub async fn configure(
C::QueryExecutionTimeout => "query_execution_timeout",
C::AllowBareDdl => "allow_bare_ddl",
C::ApplyAccessPolicies => "apply_access_policies",
C::ApplyAccessPoliciesSQL => "apply_access_policies_sql",
C::AllowUserSpecifiedId => "allow_user_specified_id",
C::CorsAllowOrigins => "cors_allow_origins",
C::AutoRebuildQueryCache => "auto_rebuild_query_cache",
C::AutoRebuildQueryCacheTimeout => "auto_rebuild_query_cache_timeout",
C::StoreMigrationSdl => "store_migration_sdl",
C::NetHttpMaxConnections => "net_http_max_connections",
C::HttpMaxConnections => "http_max_connections",
C::SimpleScoping => "simple_scoping",
C::WarnOldScoping => "warn_old_scoping",
};
Expand Down
12 changes: 10 additions & 2 deletions src/commands/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,12 @@ pub enum ValueParameter {
/// allowing any queries to be executed.
ApplyAccessPolicies(ConfigStr),

/// Apply access policies in SQL queries.
///
/// User-specified access policies are not applied when set to `false`,
/// allowing any queries to be executed.
ApplyAccessPoliciesSQL(ConfigStr),

/// Allow setting user-specified object identifiers.
AllowUserSpecifiedId(ConfigStr),

Expand All @@ -585,7 +591,7 @@ pub enum ValueParameter {
/// The maximum number of concurrent HTTP connections.
///
/// HTTP connections for the `std::net::http` module.
NetHttpMaxConnections(ConfigStr),
HttpMaxConnections(ConfigStr),

/// Whether to use the new simple scoping behavior (disable path factoring).
SimpleScoping(ConfigStr),
Expand Down Expand Up @@ -626,6 +632,8 @@ pub enum ConfigParameter {
AllowBareDdl,
/// Reset apply_access_policies parameter to `true`
ApplyAccessPolicies,
/// Reset apply_access_policies_sql parameter to `false`
ApplyAccessPoliciesSQL,
/// Reset allow_user_specified_id parameter to `false`
AllowUserSpecifiedId,
/// Reset cors_allow_origins to an empty set
Expand All @@ -637,7 +645,7 @@ pub enum ConfigParameter {
/// When to store resulting SDL of a Migration
StoreMigrationSdl,
/// The maximum number of concurrent HTTP connections.
NetHttpMaxConnections,
HttpMaxConnections,
/// Whether to use the new simple scoping behavior.
SimpleScoping,
/// Whether to warn when depending on old scoping behavior.
Expand Down
4 changes: 2 additions & 2 deletions src/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use tokio::sync::mpsc::channel;
use tokio_stream::StreamExt;

use edgedb_errors::{ParameterTypeMismatchError, StateMismatchError};
use edgedb_protocol::client_message::Cardinality;
use edgedb_protocol::client_message::CompilationOptions;
use edgedb_protocol::client_message::{Cardinality, IoFormat};
use edgedb_protocol::common::RawTypedesc;
use edgedb_protocol::common::{Capabilities, State};
use edgedb_protocol::common::{Capabilities, IoFormat, State};
use edgedb_protocol::descriptors::Typedesc;
use edgedb_protocol::model::Duration;
use edgedb_protocol::value::Value;
Expand Down
8 changes: 3 additions & 5 deletions src/variables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,12 @@ pub async fn input_variables(
}

fn get_descriptor_type<'a>(
mut desc: &'a Descriptor,
desc: &'a Descriptor,
all: &'a Typedesc,
) -> Result<Arc<dyn VariableInput>, anyhow::Error> {
if let Descriptor::Scalar(s) = desc {
desc = all.get(s.base_type_pos)?;
}
let base = desc.normalize_to_base(&all.as_query_arg_context())?;

match desc {
match base {
Descriptor::BaseScalar(s) => {
let var_type: Arc<dyn VariableInput> = match *s.id {
codec::STD_STR => Arc::new(variable::Str),
Expand Down

0 comments on commit 4e7988a

Please sign in to comment.