pub struct Cursor(/* private fields */);Expand description
How far a scan has got, and the number the client holds between calls.
It is a position in the keyspace and not a position in memory. Two calls a week apart with the same cursor resume at the same place, even if every segment in the index has split in between.
Implementations§
Source§impl Cursor
impl Cursor
Sourcepub const fn from_raw(raw: u64) -> Cursor
pub const fn from_raw(raw: u64) -> Cursor
The cursor a client sent, whatever it sent.
Any number is a valid cursor. A made up one resumes somewhere arbitrary and answers keys from there, which is what Redis does and is the only behaviour that does not require the server to remember every cursor it has ever handed out.
Sourcepub const fn stripe(self) -> usize
pub const fn stripe(self) -> usize
Which index of several this cursor was walking.
The index itself never reads this and never writes it. It is here because the number a client holds has one bit budget and the layer above needs a field in it, and a field handed out in two places is a field that collides. See the module docs for the rest of the shape.
Sourcepub const fn with_stripe(self, stripe: usize) -> Cursor
pub const fn with_stripe(self, stripe: usize) -> Cursor
The same cursor with a stripe number written into it.
A number too big for the field is masked down rather than refused, and
nothing can hand one over: the field holds
STRIPE_BITS bits and that is what the width above it is capped at.
Sourcepub const fn without_stripe(self) -> Cursor
pub const fn without_stripe(self) -> Cursor
The same cursor with the stripe number taken back out.
What the index is handed, so that a walk of one stripe cannot tell it is one of several. Which also means that a cursor holding nothing but a stripe number is the start of that stripe.