Skip to content
Snippets Groups Projects
Commit 5aeb07cb authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon:
Browse files

refactor: replicaset_weight without deserializing the whole tuple

parent 13592450
No related branches found
No related tags found
1 merge request!299Feat/poor mans vshard
......@@ -179,9 +179,11 @@ impl State {
#[inline]
pub fn replicaset_weight(&self, replicaset_id: &str) -> tarantool::Result<Option<Weight>> {
// I tried doing tuple.try_get(format!("[1]['{replicaset_id}']").as_str())
// but it doesn't work :(
Ok(self.replicaset_weights()?.get(replicaset_id).copied())
let tuple = self.space().get(&[StateKey::ReplicasetWeights])?;
match tuple {
Some(tuple) => tuple.try_get(format!("value['{replicaset_id}']").as_str()),
None => Ok(None),
}
}
#[inline]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment