You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Proxy must be able to reliably detect whether a statement requires
transformation because if a statement does not require transformation
then the potentially expensive AST rebuilding step can be skipped.
The result of type-checking is insufficient in general to tell whether a
statement requires transformation unless the `TransformationRule` logic
is duplicated in the Proxy - which we don't want of course.
This commit extends the `TransformationRule` trait with a
`would_edit` method which answers the question "would this rule change
the AST if it was applied?".
Additionally, a new `TranformationRule` impl `DryRunnable` wraps another
rule in such a way that it can "pretend" to be performing a
`Transform` (as far as `sqltk` is concerned) when really its doing a
dry-run after which it will tell us if it *would* change the AST.
This is all wrapped up by `TypedStatement::transform`Vjjj which now returns
`Result<Cow<Statement>, _>`.
When the statement does not need to be modified it returns
`Cow::Borrowed(unmodified_statement)` and when the statement *has* been
modified it returns a `Cow::Owned(modified_statement)`
The Proxy `frontend` can now distinguish between the two cases via the
`Cow`, and manage its passthrough counter correctly without having to be
coupled to implementation details of the EQL Mapper.
Copy file name to clipboardExpand all lines: packages/cipherstash-proxy/src/error.rs
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
usecrate::{postgresql::Column,Identifier};
2
2
use bytes::BytesMut;
3
3
use cipherstash_client::encryption;
4
+
use eql_mapper::EqlMapperError;
4
5
use metrics_exporter_prometheus::BuildError;
5
6
use std::{io, time::Duration};
6
7
use thiserror::Error;
@@ -92,6 +93,9 @@ pub enum MappingError {
92
93
93
94
#[error("Statement encountered an internal error. This may be a bug in the statement mapping module of CipherStash Proxy. Please visit {}#mapping-internal-error for more information.",ERROR_DOC_BASE_URL)]
0 commit comments