Skip to content

Commit 672204a

Browse files
psarnacvybhu
authored andcommitted
statement: implement Debug for PreparedStatement
For debugging purposes.
1 parent 3ee5f33 commit 672204a

File tree

5 files changed

+7
-2
lines changed

5 files changed

+7
-2
lines changed

examples/parallel-prepared.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ async fn main() -> Result<()> {
2828
.prepare("INSERT INTO ks.t2 (a, b, c) VALUES (?, ?, 'abc')")
2929
.await?,
3030
);
31+
println!("Prepared statement: {:#?}", prepared);
3132

3233
let parallelism = 256;
3334
let sem = Arc::new(Semaphore::new(parallelism));

scylla/src/statement/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub mod query;
99

1010
pub use crate::frame::types::{Consistency, SerialConsistency};
1111

12+
#[derive(Debug)]
1213
pub struct StatementConfig {
1314
pub consistency: Option<Consistency>,
1415
pub serial_consistency: Option<SerialConsistency>,

scylla/src/statement/prepared_statement.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::transport::partitioner::PartitionerName;
1212
use crate::transport::retry_policy::RetryPolicy;
1313

1414
/// Represents a statement prepared on the server.
15+
#[derive(Debug)]
1516
pub struct PreparedStatement {
1617
pub(crate) config: StatementConfig,
1718
pub prepare_tracing_ids: Vec<Uuid>,

scylla/src/transport/retry_policy.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub enum RetryDecision {
2525
}
2626

2727
/// Specifies a policy used to decide when to retry a query
28-
pub trait RetryPolicy: Send + Sync {
28+
pub trait RetryPolicy: std::fmt::Debug + Send + Sync {
2929
/// Called for each new query, starts a session of deciding about retries
3030
fn new_session(&self) -> Box<dyn RetrySession>;
3131

@@ -50,6 +50,7 @@ pub trait RetrySession: Send + Sync {
5050
}
5151

5252
/// Forwards all errors directly to the user, never retries
53+
#[derive(Debug)]
5354
pub struct FallthroughRetryPolicy;
5455
pub struct FallthroughRetrySession;
5556

@@ -85,6 +86,7 @@ impl RetrySession for FallthroughRetrySession {
8586

8687
/// Default retry policy - retries when there is a high chance that a retry might help.\
8788
/// Behaviour based on [DataStax Java Driver](https://docs.datastax.com/en/developer/java-driver/4.10/manual/core/retries/)
89+
#[derive(Debug)]
8890
pub struct DefaultRetryPolicy;
8991

9092
impl DefaultRetryPolicy {

scylla/src/transport/speculative_execution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub struct Context {
1414

1515
/// The policy that decides if the driver will send speculative queries to the
1616
/// next hosts when the current host takes too long to respond.
17-
pub trait SpeculativeExecutionPolicy: Send + Sync {
17+
pub trait SpeculativeExecutionPolicy: std::fmt::Debug + Send + Sync {
1818
/// The maximum number of speculative executions that will be triggered
1919
/// for a given request (does not include the initial request)
2020
fn max_retry_count(&self, context: &Context) -> usize;

0 commit comments

Comments
 (0)