Skip to content

Commit 774a630

Browse files
authored
Merge pull request #778 from wprzytula/write-coalescing-control-in-cloud
session_builder: move `write_coalescing()` to generic builder
2 parents 9d76db1 + 9469fe2 commit 774a630

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

scylla/src/transport/session_builder.rs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -300,37 +300,6 @@ impl SessionBuilder {
300300
self
301301
}
302302

303-
/// If true, the driver will inject a small delay before flushing data
304-
/// to the socket - by rescheduling the task that writes data to the socket.
305-
/// This gives the task an opportunity to collect more write requests
306-
/// and write them in a single syscall, increasing the efficiency.
307-
///
308-
/// However, this optimization may worsen latency if the rate of requests
309-
/// issued by the application is low, but otherwise the application is
310-
/// heavily loaded with other tasks on the same tokio executor.
311-
/// Please do performance measurements before committing to disabling
312-
/// this option.
313-
///
314-
/// This option is true by default.
315-
///
316-
/// # Example
317-
/// ```
318-
/// # use scylla::{Session, SessionBuilder};
319-
/// # use scylla::transport::Compression;
320-
/// # async fn example() -> Result<(), Box<dyn std::error::Error>> {
321-
/// let session: Session = SessionBuilder::new()
322-
/// .known_node("127.0.0.1:9042")
323-
/// .write_coalescing(false) // Enabled by default
324-
/// .build()
325-
/// .await?;
326-
/// # Ok(())
327-
/// # }
328-
/// ```
329-
pub fn write_coalescing(mut self, enable: bool) -> Self {
330-
self.config.enable_write_coalescing = enable;
331-
self
332-
}
333-
334303
/// ssl feature
335304
/// Provide SessionBuilder with SslContext from openssl crate that will be
336305
/// used to create an ssl connection to the database.
@@ -901,6 +870,37 @@ impl<K: SessionBuilderKind> GenericSessionBuilder<K> {
901870
self.config.tracing_info_fetch_consistency = consistency;
902871
self
903872
}
873+
874+
/// If true, the driver will inject a small delay before flushing data
875+
/// to the socket - by rescheduling the task that writes data to the socket.
876+
/// This gives the task an opportunity to collect more write requests
877+
/// and write them in a single syscall, increasing the efficiency.
878+
///
879+
/// However, this optimization may worsen latency if the rate of requests
880+
/// issued by the application is low, but otherwise the application is
881+
/// heavily loaded with other tasks on the same tokio executor.
882+
/// Please do performance measurements before committing to disabling
883+
/// this option.
884+
///
885+
/// This option is true by default.
886+
///
887+
/// # Example
888+
/// ```
889+
/// # use scylla::{Session, SessionBuilder};
890+
/// # use scylla::transport::Compression;
891+
/// # async fn example() -> Result<(), Box<dyn std::error::Error>> {
892+
/// let session: Session = SessionBuilder::new()
893+
/// .known_node("127.0.0.1:9042")
894+
/// .write_coalescing(false) // Enabled by default
895+
/// .build()
896+
/// .await?;
897+
/// # Ok(())
898+
/// # }
899+
/// ```
900+
pub fn write_coalescing(mut self, enable: bool) -> Self {
901+
self.config.enable_write_coalescing = enable;
902+
self
903+
}
904904
}
905905

906906
/// Creates a [`SessionBuilder`] with default configuration, same as [`SessionBuilder::new`]

0 commit comments

Comments
 (0)