Skip to content

Implement nth method for scylla::transport::locator::ReplicaSetIterator more efficiently #674

Open
@havaker

Description

@havaker

Manual implementation for ChainedNTS variant would be more efficient than just skipping nodes via .next() (#612 (comment)).

fn nth(&mut self, n: usize) -> Option<Self::Item> {
match &mut self.inner {
ReplicaSetIteratorInner::Plain { replicas: _, idx } => {
*idx += n;
self.next()
}
_ => {
for _i in 0..n {
self.next()?;
}
self.next()
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions