-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(query-engine-common): reduce duplicated code between query-engine-node-api
and query-engine-wasm
#4521
Conversation
…asm32-unknown-unknown compilation
…github.com:prisma/prisma-engines into feat/sql-query-connector-on-wasm32-unknown-unknown
…o feat/query-core-on-wasm32-unknown-unknown
* qe-wasm: Partially fix the test suite 1. Bash script for build did not abort on error, hence sed error on linux went unnoticed. 2. We don't actually need sed trickery sincce `wasm-pack` has a flag for changing binary name. 3. `tracing` feature does not actually work on WASM even partially: it panics on `Instant` invokation as soon as first span is created. Since we are running tests with all preview features enabled, that means that practically any test panics now. Disabled it again. A lot of tests are still failing on ThreadRng invocation and stacktrace is not really helpful, but I still think it's better if we get it working. * Update query-engine/query-engine-wasm/build.sh
d7ad5d5
to
c7c8586
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care of that! Are there reasons why 👇🏻 cannot be part of query-engine-common
too?
prisma-engines/query-engine/query-engine-node-api/src/engine.rs
Lines 35 to 78 in 9cb6834
/// The state of the engine. | |
enum Inner { | |
/// Not connected, holding all data to form a connection. | |
Builder(EngineBuilder), | |
/// A connected engine, holding all data to disconnect and form a new | |
/// connection. Allows querying when on this state. | |
Connected(ConnectedEngine), | |
} | |
/// Everything needed to connect to the database and have the core running. | |
struct EngineBuilder { | |
schema: Arc<psl::ValidatedSchema>, | |
config_dir: PathBuf, | |
env: HashMap<String, String>, | |
engine_protocol: EngineProtocol, | |
} | |
/// Internal structure for querying and reconnecting with the engine. | |
struct ConnectedEngine { | |
schema: Arc<psl::ValidatedSchema>, | |
query_schema: Arc<QuerySchema>, | |
executor: crate::Executor, | |
config_dir: PathBuf, | |
env: HashMap<String, String>, | |
metrics: Option<MetricRegistry>, | |
engine_protocol: EngineProtocol, | |
} | |
/// Returned from the `serverInfo` method in javascript. | |
#[derive(Debug, Serialize)] | |
#[serde(rename_all = "camelCase")] | |
struct ServerInfo { | |
commit: String, | |
version: String, | |
primary_connector: Option<String>, | |
} | |
#[derive(Debug, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
struct MetricOptions { | |
format: MetricFormat, | |
#[serde(default)] | |
global_labels: HashMap<String, String>, | |
} |
Thumbs up! I've been waiting for it for a year! Finally, third-party clients no longer have to copy Prisma engines code! Engine upgrades will not bring devastating damage to third-party clients! |
Could more be done? For example, it is the same as described in #3757, because a large amount of logic code is common between wasm engine and napi engine. |
Good question! There is no good reason to exclude that, besides that it'd need some additional conditional checks. |
Oh, and |
WASM Size
|
…ct field by introducing *Native structs conditionally
This PR closes https://github.com/prisma/team-orm/issues/692.
This PR is a follow-up of #4466.
/integration