Skip to content

Commit

Permalink
exec_profile_handle: allow public access to associated profile
Browse files Browse the repository at this point in the history
Last time, I introduced getters for `ExecutionProfile`.
However, I forgot that in cpp-rust-driver use case, we only have
an access to `ExecutionProfileHandle`...

Since, we can convert handle to builder, I see no objections against
having the ability to convert it to well-defined execution profile.

Obviously, we need to clone an `Arc`. But only a single one.
Notice, however, that when converting to builder,
we need to clone multiple Arcs anyway (e.g. retry or load balancing policies).
  • Loading branch information
muzarski committed Oct 29, 2024
1 parent da199a1 commit 9df44f6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scylla/src/transport/execution_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@ impl ExecutionProfileHandle {
self.0 .0.load().to_builder()
}

/// Returns execution profile pointed by this handle.
pub fn to_profile(&self) -> ExecutionProfile {
ExecutionProfile(self.access())
}

/// Makes the handle point to a new execution profile.
/// All entities (queries/Session) holding this handle will reflect the change.
pub fn map_to_another_profile(&mut self, profile: ExecutionProfile) {
Expand Down

0 comments on commit 9df44f6

Please sign in to comment.