From 9df44f6a8de69558fed31eb481bb15eaa98b664a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Uzarski?= Date: Tue, 29 Oct 2024 15:11:58 +0100 Subject: [PATCH] exec_profile_handle: allow public access to associated profile 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). --- scylla/src/transport/execution_profile.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scylla/src/transport/execution_profile.rs b/scylla/src/transport/execution_profile.rs index 9a237ab44..a94addec5 100644 --- a/scylla/src/transport/execution_profile.rs +++ b/scylla/src/transport/execution_profile.rs @@ -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) {