Skip to main content

Connection

Struct Connection 

Source
pub struct Connection {
    pub write_buffer: Vec<u8>,
    pub connection_id: usize,
    pub subscription_count: usize,
    pub client_name: Option<String>,
    pub client_addr: Option<SocketAddr>,
    pub connected_at: u64,
    pub commands_processed: u64,
    pub flags: Vec<String>,
    /* private fields */
}
Expand description

Manages a client connection with RESP protocol handling

Handles command parsing, execution, and response buffering.

Fields§

§write_buffer: Vec<u8>§connection_id: usize§subscription_count: usize§client_name: Option<String>§client_addr: Option<SocketAddr>§connected_at: u64§commands_processed: u64§flags: Vec<String>

Implementations§

Source§

impl Connection

Source

pub fn new( fd: RawFd, buffer_size: usize, store: Arc<FeoxStore>, config: &Config, ) -> Self

Create a new connection handler

Source

pub fn set_client_registry(&mut self, registry: Arc<ClientRegistry>)

Set the executor with client registry info

Source

pub fn new_with_addr( fd: RawFd, buffer_size: usize, store: Arc<FeoxStore>, config: &Config, addr: Option<SocketAddr>, ) -> Self

Create a new connection handler with address

Source

pub fn fd(&self) -> RawFd

Source

pub fn is_closed(&self) -> bool

Source

pub fn close(&mut self)

Source

pub fn set_authenticated(&mut self, authenticated: bool)

Set authentication status

Source

pub fn is_authenticated(&self) -> bool

Check if connection is authenticated

Source

pub fn process_read(&mut self, data: &[u8]) -> Result<Vec<PubSubOp>>

Process incoming data with inline execution Returns pub/sub operations that need to be executed

Source

pub fn pending_writes(&mut self) -> Option<&[u8]>

Get pending write data as a single buffer slice

Source

pub fn consume_writes(&mut self, n: usize)

Mark bytes as written

Source

pub fn queue_pubsub_message(&mut self, message: PubSubMessage)

Add a pub/sub message to the pending queue

Source

pub fn is_in_pubsub_mode(&self) -> bool

Check if connection is in pub/sub mode

Source

pub fn set_subscription_count(&mut self, count: usize)

Update subscription count

Source

pub fn process_pubsub_messages(&mut self)

Process pending pub/sub messages

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more