pub struct DirectWorker { /* private fields */ }Expand description
Compatibility alias for PhysicalWorker.
PhysicalWorker executes transfer operations using a local TransferManager.
This is the fundamental worker type that directly owns a TransferManager and
layout handles for executing data transfers. It implements the Worker and
WorkerTransfers traits for single-worker scenarios.
§Builder fields
| Field | Required | Description |
|---|---|---|
manager | yes | TransferManager that executes actual data movement |
g1_handle | no | GPU KV cache layout handle (for GPU transfers) |
g2_handle | no | Host/pinned cache layout handle (for host transfers) |
g3_handle | no | Disk cache layout handle (for disk-tier transfers) |
rank | no | Worker rank for object-key prefixing in SPMD setups |
object_client | no | Object storage client for G4 tier (S3, etc.) |
§Execution State vs Coordination State
PhysicalWorker maintains execution state – the handles and manager needed
to actually perform RDMA/local transfers. This is distinct from
coordination state which the leader tracks in CoordinatedWorker.
When a leader wraps a PhysicalWorker in a CoordinatedWorker:
- PhysicalWorker: owns handles for TransferManager execution
- CoordinatedWorker: tracks the same handles for leader coordination
This duplication is intentional – PhysicalWorker needs handles to execute, and CoordinatedWorker provides a uniform API regardless of whether the inner worker is local (PhysicalWorker) or remote (VeloWorkerClient).
§Typical lifecycle
- Created via
PhysicalWorker::builder()during deferred initialization - Wrapped by
VeloWorkerServiceto expose RPC handlers - Wrapped by
CoordinatedWorkerfor leader coordination - Used as a building block in parallel workers (e.g.,
SpmdParallelWorkers)
Implementations§
Source§impl PhysicalWorker
impl PhysicalWorker
Sourcepub fn builder() -> PhysicalWorkerBuilder
pub fn builder() -> PhysicalWorkerBuilder
Sourcepub fn object_client(&self) -> Option<&Arc<dyn ObjectBlockOps>>
pub fn object_client(&self) -> Option<&Arc<dyn ObjectBlockOps>>
Get the object storage client (if set).
Sourcepub fn g1_handle(&self) -> Option<LayoutHandle>
pub fn g1_handle(&self) -> Option<LayoutHandle>
Get the G1 layout handle (if set).
Sourcepub fn g2_handle(&self) -> Option<LayoutHandle>
pub fn g2_handle(&self) -> Option<LayoutHandle>
Get the G2 layout handle (if set).
Sourcepub fn g3_handle(&self) -> Option<LayoutHandle>
pub fn g3_handle(&self) -> Option<LayoutHandle>
Get the G3 layout handle (if set).
Sourcepub fn transfer_manager(&self) -> &TransferManager
pub fn transfer_manager(&self) -> &TransferManager
Get a reference to the TransferManager.
Sourcepub fn resolve_layout(
&self,
logical: LogicalLayoutHandle,
) -> Result<PhysicalLayout>
pub fn resolve_layout( &self, logical: LogicalLayoutHandle, ) -> Result<PhysicalLayout>
Sourcepub fn create_bounce_buffer(
&self,
handle: LayoutHandle,
block_ids: Vec<BlockId>,
) -> Result<BounceBuffer>
pub fn create_bounce_buffer( &self, handle: LayoutHandle, block_ids: Vec<BlockId>, ) -> Result<BounceBuffer>
Create a bounce buffer specification from a layout handle and block IDs.
Sourcepub fn export_metadata(&self) -> Result<SerializedLayout>
pub fn export_metadata(&self) -> Result<SerializedLayout>
Export serialized layout metadata with proper logical type mappings.
This exports layouts with their logical types (G1, G2, G3) so that remote instances can correctly identify which handle corresponds to which tier during RDMA transfers.
Sourcepub fn import_metadata(
&self,
metadata: SerializedLayout,
) -> Result<Vec<LayoutHandle>>
pub fn import_metadata( &self, metadata: SerializedLayout, ) -> Result<Vec<LayoutHandle>>
Import serialized layout metadata into the transfer manager.
Trait Implementations§
Source§impl ObjectBlockOps for PhysicalWorker
impl ObjectBlockOps for PhysicalWorker
Source§fn has_blocks(
&self,
keys: Vec<SequenceHash>,
) -> BoxFuture<'static, Vec<(SequenceHash, Option<usize>)>>
fn has_blocks( &self, keys: Vec<SequenceHash>, ) -> BoxFuture<'static, Vec<(SequenceHash, Option<usize>)>>
Source§fn put_blocks(
&self,
keys: Vec<SequenceHash>,
src_layout: LogicalLayoutHandle,
block_ids: Vec<BlockId>,
) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
fn put_blocks( &self, keys: Vec<SequenceHash>, src_layout: LogicalLayoutHandle, block_ids: Vec<BlockId>, ) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
Source§fn get_blocks(
&self,
keys: Vec<SequenceHash>,
dst_layout: LogicalLayoutHandle,
block_ids: Vec<BlockId>,
) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
fn get_blocks( &self, keys: Vec<SequenceHash>, dst_layout: LogicalLayoutHandle, block_ids: Vec<BlockId>, ) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
Source§fn put_blocks_with_layout(
&self,
keys: Vec<SequenceHash>,
_layout: PhysicalLayout,
_block_ids: Vec<BlockId>,
) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
fn put_blocks_with_layout( &self, keys: Vec<SequenceHash>, _layout: PhysicalLayout, _block_ids: Vec<BlockId>, ) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
Source§fn get_blocks_with_layout(
&self,
keys: Vec<SequenceHash>,
_layout: PhysicalLayout,
_block_ids: Vec<BlockId>,
) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
fn get_blocks_with_layout( &self, keys: Vec<SequenceHash>, _layout: PhysicalLayout, _block_ids: Vec<BlockId>, ) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
Source§impl Worker for PhysicalWorker
impl Worker for PhysicalWorker
Source§fn g1_handle(&self) -> Option<LayoutHandle>
fn g1_handle(&self) -> Option<LayoutHandle>
Source§fn g2_handle(&self) -> Option<LayoutHandle>
fn g2_handle(&self) -> Option<LayoutHandle>
Source§fn g3_handle(&self) -> Option<LayoutHandle>
fn g3_handle(&self) -> Option<LayoutHandle>
Source§fn export_metadata(&self) -> Result<SerializedLayoutResponse>
fn export_metadata(&self) -> Result<SerializedLayoutResponse>
Source§fn import_metadata(
&self,
metadata: SerializedLayout,
) -> Result<ImportMetadataResponse>
fn import_metadata( &self, metadata: SerializedLayout, ) -> Result<ImportMetadataResponse>
Source§impl WorkerTransfers for PhysicalWorker
impl WorkerTransfers for PhysicalWorker
Source§fn execute_local_transfer(
&self,
src: LogicalLayoutHandle,
dst: LogicalLayoutHandle,
src_block_ids: Arc<[BlockId]>,
dst_block_ids: Arc<[BlockId]>,
options: TransferOptions,
) -> Result<TransferCompleteNotification>
fn execute_local_transfer( &self, src: LogicalLayoutHandle, dst: LogicalLayoutHandle, src_block_ids: Arc<[BlockId]>, dst_block_ids: Arc<[BlockId]>, options: TransferOptions, ) -> Result<TransferCompleteNotification>
Source§fn execute_remote_onboard(
&self,
src: RemoteDescriptor,
dst: LogicalLayoutHandle,
dst_block_ids: Arc<[BlockId]>,
options: TransferOptions,
) -> Result<TransferCompleteNotification>
fn execute_remote_onboard( &self, src: RemoteDescriptor, dst: LogicalLayoutHandle, dst_block_ids: Arc<[BlockId]>, options: TransferOptions, ) -> Result<TransferCompleteNotification>
Source§fn execute_remote_offload(
&self,
src: LogicalLayoutHandle,
src_block_ids: Arc<[BlockId]>,
dst: RemoteDescriptor,
_options: TransferOptions,
) -> Result<TransferCompleteNotification>
fn execute_remote_offload( &self, src: LogicalLayoutHandle, src_block_ids: Arc<[BlockId]>, dst: RemoteDescriptor, _options: TransferOptions, ) -> Result<TransferCompleteNotification>
Source§fn connect_remote(
&self,
instance_id: InstanceId,
metadata: Vec<SerializedLayout>,
) -> Result<ConnectRemoteResponse>
fn connect_remote( &self, instance_id: InstanceId, metadata: Vec<SerializedLayout>, ) -> Result<ConnectRemoteResponse>
Source§fn has_remote_metadata(&self, instance_id: InstanceId) -> bool
fn has_remote_metadata(&self, instance_id: InstanceId) -> bool
Source§fn execute_remote_onboard_for_instance(
&self,
instance_id: InstanceId,
remote_logical_type: LogicalLayoutHandle,
src_block_ids: Vec<BlockId>,
dst: LogicalLayoutHandle,
dst_block_ids: Arc<[BlockId]>,
options: TransferOptions,
) -> Result<TransferCompleteNotification>
fn execute_remote_onboard_for_instance( &self, instance_id: InstanceId, remote_logical_type: LogicalLayoutHandle, src_block_ids: Vec<BlockId>, dst: LogicalLayoutHandle, dst_block_ids: Arc<[BlockId]>, options: TransferOptions, ) -> Result<TransferCompleteNotification>
Auto Trait Implementations§
impl !Freeze for PhysicalWorker
impl !RefUnwindSafe for PhysicalWorker
impl !UnwindSafe for PhysicalWorker
impl Send for PhysicalWorker
impl Sync for PhysicalWorker
impl Unpin for PhysicalWorker
impl UnsafeUnpin for PhysicalWorker
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);