pub struct Session { /* private fields */ }Expand description
What one connection has chosen.
Implementations§
Source§impl Session
impl Session
Sourcepub fn row(&self) -> &Arc<Client> ⓘ
pub fn row(&self) -> &Arc<Client> ⓘ
The row every other thread sees this connection through.
Handed to the server once, when the connection is accepted, so that
CLIENT LIST can find it. A session nobody hands over is one no other
thread can see, which is every embedded caller and every test.
Sourcepub fn opened(&mut self, now_ms: u64)
pub fn opened(&mut self, now_ms: u64)
Say when this connection was opened, which is what age counts from.
Called by whoever opened it, which is the only place that knows. A session nobody tells has no age and reports zero, which is every embedded caller and every test.
Sourcepub fn set_socket(&mut self, peer: &str, local: &str, fd: i32, unix: bool)
pub fn set_socket(&mut self, peer: &str, local: &str, fd: i32, unix: bool)
Say what the socket under this connection is.
Called once, by whoever accepted it, which is the only place that knows.
The two addresses are already in the spelling CLIENT INFO reports them
in, because turning a socket address into that spelling is the job of the
layer that has the socket.
Sourcepub fn read_bytes(&mut self, n: usize)
pub fn read_bytes(&mut self, n: usize)
Note bytes that arrived, and that a read carried them.
Sourcepub fn wrote_bytes(&mut self, n: usize)
pub fn wrote_bytes(&mut self, n: usize)
Note bytes that went out.
Sourcepub fn note_buffers(
&mut self,
waiting: usize,
room: usize,
held: usize,
reply: usize,
)
pub fn note_buffers( &mut self, waiting: usize, room: usize, held: usize, reply: usize, )
Note what the two buffers are holding, and which protocol they are in.
waiting is the framed bytes that have not been read yet, room is what
is left in the read buffer after them, held is what the reply buffer
still owes and reply is its capacity. The high water mark is kept here
rather than by the caller so that the caller only has to say what is true
now.
Sourcepub fn note_proto(&mut self, version: i64)
pub fn note_proto(&mut self, version: i64)
Note which protocol this connection is being answered in.
Written after each command rather than with the buffers, because HELLO
changes it in the reply buffer and a connection that switched to RESP3
halfway through a pipeline should be listed as being on it.
Sourcepub fn finished(&mut self)
pub fn finished(&mut self)
Note that the command running is over, and put what it changed about this connection where another thread can see it.
The count goes up here and not where the command name is noted, so that
a connection asking CLIENT INFO is told how many commands it had sent
before this one. That is what a real server answers: it counts in
commandProcessed and that runs after the body.
The rest is the publishing. Which database a connection is in, what it is
subscribed to, whether it is in a transaction and how many keys it is
watching are all things a command can have just changed, and they are all
things CLIENT LIST on another thread reports. Rather than hunting down
every command that can move one of them, all six are written out here,
which is six ordinary stores to a line this thread already owns.
Sourcepub const fn reply_mode(&self) -> Reply
pub const fn reply_mode(&self) -> Reply
What this connection has asked to hear back.
Sourcepub const fn step_reply(&mut self)
pub const fn step_reply(&mut self)
Step the skipping state on by one command.
Called after every command by whoever is deciding whether to keep the
reply, so that SKIP covers exactly the one command after it.
Auto Trait Implementations§
impl !RefUnwindSafe for Session
impl !UnwindSafe for Session
impl Freeze for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more