Skip to content

Commit fba4ec3

Browse files
authored
RUST-1487 Rename "csfle" to "in-use-encryption-unstable" (#792)
1 parent b735ff3 commit fba4ec3

File tree

27 files changed

+97
-97
lines changed

27 files changed

+97
-97
lines changed

.evergreen/feature-combinations.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
export FEATURE_COMBINATIONS=(
77
'' # default features
88
'--no-default-features --features async-std-runtime,sync' # features that conflict w/ default features
9-
'--features tokio-sync,zstd-compression,snappy-compression,zlib-compression,openssl-tls,aws-auth,tracing-unstable,csfle' # additive features
9+
'--features tokio-sync,zstd-compression,snappy-compression,zlib-compression,openssl-tls,aws-auth,tracing-unstable,in-use-encryption-unstable' # additive features
1010
)

.evergreen/run-csfle-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source ./.evergreen/env.sh
77

88
set -o xtrace
99

10-
FEATURE_FLAGS="csfle,${TLS_FEATURE}"
10+
FEATURE_FLAGS="in-use-encryption-unstable,${TLS_FEATURE}"
1111
OPTIONS="-- -Z unstable-options --format json --report-time"
1212

1313
if [ "$SINGLE_THREAD" = true ]; then

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ zstd-compression = ["zstd"]
6767
zlib-compression = ["flate2"]
6868
snappy-compression = ["snap"]
6969

70-
# DO NOT USE; see https://jira.mongodb.org/browse/RUST-569 for the status of CSFLE support in the Rust driver.
71-
csfle = ["mongocrypt", "rayon", "num_cpus"]
70+
# The In Use Encryption API is unstable and may have backwards-incompatible changes in minor version updates.
71+
in-use-encryption-unstable = ["mongocrypt", "rayon", "num_cpus"]
7272

7373
# DO NOT USE; see https://jira.mongodb.org/browse/RUST-580 for the status of tracing/logging support in the Rust driver.
7474
# Enables support for emitting tracing events.

src/client/executor.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#[cfg(feature = "csfle")]
1+
#[cfg(feature = "in-use-encryption-unstable")]
22
use bson::RawDocumentBuf;
33
use bson::{doc, RawBsonRef, RawDocument, Timestamp};
4-
#[cfg(feature = "csfle")]
4+
#[cfg(feature = "in-use-encryption-unstable")]
55
use futures_core::future::BoxFuture;
66
use lazy_static::lazy_static;
77
use serde::de::DeserializeOwned;
@@ -607,7 +607,7 @@ impl Client {
607607
let target_db = cmd.target_db.clone();
608608

609609
let serialized = op.serialize_command(cmd)?;
610-
#[cfg(feature = "csfle")]
610+
#[cfg(feature = "in-use-encryption-unstable")]
611611
let serialized = {
612612
let guard = self.inner.csfle.read().await;
613613
if let Some(ref csfle) = *guard {
@@ -775,7 +775,7 @@ impl Client {
775775
})
776776
});
777777

778-
#[cfg(feature = "csfle")]
778+
#[cfg(feature = "in-use-encryption-unstable")]
779779
let response = {
780780
let guard = self.inner.csfle.read().await;
781781
if let Some(ref csfle) = *guard {
@@ -801,7 +801,7 @@ impl Client {
801801
}
802802
}
803803

804-
#[cfg(feature = "csfle")]
804+
#[cfg(feature = "in-use-encryption-unstable")]
805805
fn auto_encrypt<'a>(
806806
&'a self,
807807
csfle: &'a super::csfle::ClientState,
@@ -817,7 +817,7 @@ impl Client {
817817
})
818818
}
819819

820-
#[cfg(feature = "csfle")]
820+
#[cfg(feature = "in-use-encryption-unstable")]
821821
fn auto_decrypt<'a>(
822822
&'a self,
823823
csfle: &'a super::csfle::ClientState,

src/client/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub mod auth;
2-
#[cfg(feature = "csfle")]
2+
#[cfg(feature = "in-use-encryption-unstable")]
33
pub(crate) mod csfle;
44
mod executor;
55
pub mod options;
@@ -10,7 +10,7 @@ use std::{
1010
time::{Duration, Instant},
1111
};
1212

13-
#[cfg(feature = "csfle")]
13+
#[cfg(feature = "in-use-encryption-unstable")]
1414
pub use self::csfle::client_builder::*;
1515
use derivative::Derivative;
1616

@@ -113,7 +113,7 @@ struct ClientInner {
113113
topology: Topology,
114114
options: ClientOptions,
115115
session_pool: ServerSessionPool,
116-
#[cfg(feature = "csfle")]
116+
#[cfg(feature = "in-use-encryption-unstable")]
117117
csfle: tokio::sync::RwLock<Option<csfle::ClientState>>,
118118
}
119119

@@ -136,7 +136,7 @@ impl Client {
136136
let inner = Arc::new(ClientInner {
137137
topology: Topology::new(options.clone())?,
138138
session_pool: ServerSessionPool::new(),
139-
#[cfg(feature = "csfle")]
139+
#[cfg(feature = "in-use-encryption-unstable")]
140140
csfle: Default::default(),
141141
options,
142142
});
@@ -166,7 +166,7 @@ impl Client {
166166
/// # Ok(())
167167
/// # }
168168
/// ```
169-
#[cfg(feature = "csfle")]
169+
#[cfg(feature = "in-use-encryption-unstable")]
170170
pub fn encrypted_builder(
171171
client_options: ClientOptions,
172172
key_vault_namespace: crate::Namespace,
@@ -187,7 +187,7 @@ impl Client {
187187
))
188188
}
189189

190-
#[cfg(all(test, feature = "csfle"))]
190+
#[cfg(all(test, feature = "in-use-encryption-unstable"))]
191191
pub(crate) async fn mongocryptd_spawned(&self) -> bool {
192192
self.inner
193193
.csfle
@@ -197,7 +197,7 @@ impl Client {
197197
.map_or(false, |cs| cs.exec().mongocryptd_spawned())
198198
}
199199

200-
#[cfg(all(test, feature = "csfle"))]
200+
#[cfg(all(test, feature = "in-use-encryption-unstable"))]
201201
pub(crate) async fn has_mongocryptd_client(&self) -> bool {
202202
self.inner
203203
.csfle
@@ -558,14 +558,14 @@ impl Client {
558558
&self.inner.topology
559559
}
560560

561-
#[cfg(feature = "csfle")]
561+
#[cfg(feature = "in-use-encryption-unstable")]
562562
pub(crate) fn weak(&self) -> WeakClient {
563563
WeakClient {
564564
inner: Arc::downgrade(&self.inner),
565565
}
566566
}
567567

568-
#[cfg(feature = "csfle")]
568+
#[cfg(feature = "in-use-encryption-unstable")]
569569
pub(crate) async fn auto_encryption_opts(
570570
&self,
571571
) -> Option<tokio::sync::RwLockReadGuard<'_, csfle::options::AutoEncryptionOptions>> {
@@ -581,13 +581,13 @@ impl Client {
581581
}
582582
}
583583

584-
#[cfg(feature = "csfle")]
584+
#[cfg(feature = "in-use-encryption-unstable")]
585585
#[derive(Clone, Debug)]
586586
pub(crate) struct WeakClient {
587587
inner: std::sync::Weak<ClientInner>,
588588
}
589589

590-
#[cfg(feature = "csfle")]
590+
#[cfg(feature = "in-use-encryption-unstable")]
591591
impl WeakClient {
592592
#[allow(dead_code)]
593593
pub(crate) fn upgrade(&self) -> Option<Client> {

src/coll/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl<T> Collection<T> {
228228
let mut options: Option<DropCollectionOptions> = options.into();
229229
resolve_options!(self, options, [write_concern]);
230230

231-
#[cfg(feature = "csfle")]
231+
#[cfg(feature = "in-use-encryption-unstable")]
232232
self.drop_aux_collections(options.as_ref(), session.as_deref_mut())
233233
.await?;
234234

@@ -253,7 +253,7 @@ impl<T> Collection<T> {
253253
self.drop_common(options, session).await
254254
}
255255

256-
#[cfg(feature = "csfle")]
256+
#[cfg(feature = "in-use-encryption-unstable")]
257257
#[allow(clippy::needless_option_as_deref)]
258258
async fn drop_aux_collections(
259259
&self,
@@ -1189,9 +1189,9 @@ where
11891189
}
11901190

11911191
let ordered = options.as_ref().and_then(|o| o.ordered).unwrap_or(true);
1192-
#[cfg(feature = "csfle")]
1192+
#[cfg(feature = "in-use-encryption-unstable")]
11931193
let encrypted = self.client().auto_encryption_opts().await.is_some();
1194-
#[cfg(not(feature = "csfle"))]
1194+
#[cfg(not(feature = "in-use-encryption-unstable"))]
11951195
let encrypted = false;
11961196

11971197
let mut cumulative_failure: Option<BulkWriteFailure> = None;

src/coll/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ pub struct DropCollectionOptions {
10701070
/// Map of encrypted fields for the collection.
10711071
// Serialization is skipped because the server doesn't accept this option; it's needed for
10721072
// preprocessing. Deserialization needs to remain because it's used in test files.
1073-
#[cfg(feature = "csfle")]
1073+
#[cfg(feature = "in-use-encryption-unstable")]
10741074
#[serde(skip_serializing)]
10751075
pub encrypted_fields: Option<Document>,
10761076
}

src/db/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub mod options;
22

33
use std::{fmt::Debug, sync::Arc};
44

5-
#[cfg(feature = "csfle")]
5+
#[cfg(feature = "in-use-encryption-unstable")]
66
use bson::doc;
77
use futures_util::stream::TryStreamExt;
88

@@ -304,7 +304,7 @@ impl Database {
304304
coll: name.as_ref().to_string(),
305305
};
306306

307-
#[cfg(feature = "csfle")]
307+
#[cfg(feature = "in-use-encryption-unstable")]
308308
let has_encrypted_fields = {
309309
self.resolve_encrypted_fields(&ns, &mut options).await;
310310
self.create_aux_collections(&ns, &options, session.as_deref_mut())
@@ -320,7 +320,7 @@ impl Database {
320320
.execute_operation(create, session.as_deref_mut())
321321
.await?;
322322

323-
#[cfg(feature = "csfle")]
323+
#[cfg(feature = "in-use-encryption-unstable")]
324324
if has_encrypted_fields {
325325
let coll = self.collection::<Document>(&ns.coll);
326326
coll.create_index_common(
@@ -337,7 +337,7 @@ impl Database {
337337
Ok(())
338338
}
339339

340-
#[cfg(feature = "csfle")]
340+
#[cfg(feature = "in-use-encryption-unstable")]
341341
async fn resolve_encrypted_fields(
342342
&self,
343343
base_ns: &Namespace,
@@ -363,7 +363,7 @@ impl Database {
363363
}
364364
}
365365

366-
#[cfg(feature = "csfle")]
366+
#[cfg(feature = "in-use-encryption-unstable")]
367367
#[allow(clippy::needless_option_as_deref)]
368368
async fn create_aux_collections(
369369
&self,

src/db/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub struct CreateCollectionOptions {
118118
pub comment: Option<Bson>,
119119

120120
/// Map of encrypted fields for the created collection.
121-
#[cfg(feature = "csfle")]
121+
#[cfg(feature = "in-use-encryption-unstable")]
122122
pub encrypted_fields: Option<Document>,
123123
}
124124

src/error.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ impl Error {
231231
)
232232
}
233233

234-
#[cfg(all(test, feature = "csfle"))]
234+
#[cfg(all(test, feature = "in-use-encryption-unstable"))]
235235
pub(crate) fn is_csfle_error(&self) -> bool {
236-
matches!(self.kind.as_ref(), ErrorKind::Csfle(..),)
236+
matches!(self.kind.as_ref(), ErrorKind::Encryption(..))
237237
}
238238

239239
/// Gets the code from this error for performing SDAM updates, if applicable.
@@ -287,8 +287,8 @@ impl Error {
287287
ErrorKind::Transaction { message } => Some(message.clone()),
288288
ErrorKind::IncompatibleServer { message } => Some(message.clone()),
289289
ErrorKind::InvalidArgument { message } => Some(message.clone()),
290-
#[cfg(feature = "csfle")]
291-
ErrorKind::Csfle(err) => err.message.clone(),
290+
#[cfg(feature = "in-use-encryption-unstable")]
291+
ErrorKind::Encryption(err) => err.message.clone(),
292292
_ => None,
293293
}
294294
}
@@ -424,8 +424,8 @@ impl Error {
424424
| ErrorKind::MissingResumeToken
425425
| ErrorKind::Authentication { .. }
426426
| ErrorKind::GridFs(_) => {}
427-
#[cfg(feature = "csfle")]
428-
ErrorKind::Csfle(_) => {}
427+
#[cfg(feature = "in-use-encryption-unstable")]
428+
ErrorKind::Encryption(_) => {}
429429
}
430430
}
431431
}
@@ -471,10 +471,10 @@ impl From<std::io::ErrorKind> for ErrorKind {
471471
}
472472
}
473473

474-
#[cfg(feature = "csfle")]
474+
#[cfg(feature = "in-use-encryption-unstable")]
475475
impl From<mongocrypt::error::Error> for ErrorKind {
476476
fn from(err: mongocrypt::error::Error) -> Self {
477-
Self::Csfle(err)
477+
Self::Encryption(err)
478478
}
479479
}
480480

@@ -575,9 +575,9 @@ pub enum ErrorKind {
575575
MissingResumeToken,
576576

577577
/// An error occurred during encryption or decryption.
578-
#[cfg(feature = "csfle")]
578+
#[cfg(feature = "in-use-encryption-unstable")]
579579
#[error("An error occurred during client-side encryption: {0}")]
580-
Csfle(mongocrypt::error::Error),
580+
Encryption(mongocrypt::error::Error),
581581
}
582582

583583
impl ErrorKind {

0 commit comments

Comments
 (0)