pub struct WriteCtx<'a> {
pub conn: Arc<ClientConnection>,
pub lun: u64,
pub itt: u32,
pub cmd_sn: Arc<AtomicU32>,
pub exp_stat_sn: Arc<AtomicU32>,
pub cdb: [u8; 16],
pub payload: Vec<u8>,
pub buf: [u8; 48],
pub sent_bytes: usize,
pub total_bytes: usize,
pub last_response: Option<PduResponse<ScsiCommandResponse>>,
/* private fields */
}Expand description
This structure represents the context for a SCSI Write operation.
Fields§
§conn: Arc<ClientConnection>The client connection.
lun: u64The Logical Unit Number.
itt: u32The Initiator Task Tag.
cmd_sn: Arc<AtomicU32>The Command Sequence Number.
exp_stat_sn: Arc<AtomicU32>The Expected Status Sequence Number.
cdb: [u8; 16]The SCSI Command Descriptor Block.
payload: Vec<u8>The data to be written.
buf: [u8; 48]A buffer for the BHS.
sent_bytes: usizeThe number of bytes that have been sent.
total_bytes: usizeThe total number of bytes to be sent.
last_response: Option<PduResponse<ScsiCommandResponse>>The last received command response.
Implementations§
Trait Implementations§
Source§impl<'ctx> StateMachine<WriteCtx<'ctx>, Transition<WriteStates, Result<(), Error>>> for Start
IssueCmd
impl<'ctx> StateMachine<WriteCtx<'ctx>, Transition<WriteStates, Result<(), Error>>> for Start
IssueCmd
- Send SCSI Command (WRITE) with no data in the command PDU.
- If payload is empty → go straight to waiting for SCSI Response. Otherwise → wait for R2T.
Source§type StepResult<'a> = Pin<Box<dyn Future<Output = Transition<WriteStates, Result<(), Error>>> + Send + 'a>>
where
Self: 'a,
WriteCtx<'ctx>: 'a
type StepResult<'a> = Pin<Box<dyn Future<Output = Transition<WriteStates, Result<(), Error>>> + Send + 'a>> where Self: 'a, WriteCtx<'ctx>: 'a
The future returned by the
step method.Source§fn step<'a>(&'a self, ctx: &'a mut WriteCtx<'ctx>) -> Self::StepResult<'a>
fn step<'a>(&'a self, ctx: &'a mut WriteCtx<'ctx>) -> Self::StepResult<'a>
Executes a single step of the state machine.
Source§impl<'ctx> StateMachine<WriteCtx<'ctx>, Transition<WriteStates, Result<(), Error>>> for WaitR2T
WaitR2T
impl<'ctx> StateMachine<WriteCtx<'ctx>, Transition<WriteStates, Result<(), Error>>> for WaitR2T
WaitR2T
Await an R2T. Compute the data window (offset,len) safely, then move to SendWindow. We assume sequential windows.
Source§type StepResult<'a> = Pin<Box<dyn Future<Output = Transition<WriteStates, Result<(), Error>>> + Send + 'a>>
where
Self: 'a,
WriteCtx<'ctx>: 'a
type StepResult<'a> = Pin<Box<dyn Future<Output = Transition<WriteStates, Result<(), Error>>> + Send + 'a>> where Self: 'a, WriteCtx<'ctx>: 'a
The future returned by the
step method.Source§fn step<'a>(&'a self, ctx: &'a mut WriteCtx<'ctx>) -> Self::StepResult<'a>
fn step<'a>(&'a self, ctx: &'a mut WriteCtx<'ctx>) -> Self::StepResult<'a>
Executes a single step of the state machine.
Source§impl<'ctx> StateMachine<WriteCtx<'ctx>, Transition<WriteStates, Result<(), Error>>> for Finish
WaitResp
impl<'ctx> StateMachine<WriteCtx<'ctx>, Transition<WriteStates, Result<(), Error>>> for Finish
WaitResp
Final step: wait for SCSI Command Response and validate GOOD status.
Source§type StepResult<'a> = Pin<Box<dyn Future<Output = Transition<WriteStates, Result<(), Error>>> + Send + 'a>>
where
Self: 'a,
WriteCtx<'ctx>: 'a
type StepResult<'a> = Pin<Box<dyn Future<Output = Transition<WriteStates, Result<(), Error>>> + Send + 'a>> where Self: 'a, WriteCtx<'ctx>: 'a
The future returned by the
step method.Source§fn step<'a>(&'a self, ctx: &'a mut WriteCtx<'ctx>) -> Self::StepResult<'a>
fn step<'a>(&'a self, ctx: &'a mut WriteCtx<'ctx>) -> Self::StepResult<'a>
Executes a single step of the state machine.
Source§impl<'ctx> StateMachineCtx<WriteCtx<'ctx>, WriteOutcome> for WriteCtx<'ctx>
impl<'ctx> StateMachineCtx<WriteCtx<'ctx>, WriteOutcome> for WriteCtx<'ctx>
Source§async fn execute(&mut self, _cancel: &CancellationToken) -> Result<WriteOutcome>
async fn execute(&mut self, _cancel: &CancellationToken) -> Result<WriteOutcome>
Executes the state machine to completion.
Auto Trait Implementations§
impl<'a> !Freeze for WriteCtx<'a>
impl<'a> !RefUnwindSafe for WriteCtx<'a>
impl<'a> !UnwindSafe for WriteCtx<'a>
impl<'a> Send for WriteCtx<'a>
impl<'a> Sync for WriteCtx<'a>
impl<'a> Unpin for WriteCtx<'a>
impl<'a> UnsafeUnpin for WriteCtx<'a>
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
Mutably borrows from an owned value. Read more