pub struct Contract {
pub plan: Plan,
pub group_specs: Vec<GroupSpec>,
pub field_addresses: Option<BTreeMap<String, u64>>,
/* private fields */
}Expand description
A rank’s cache transfer contract.
Fields§
§plan: PlanThe memory plan.
group_specs: Vec<GroupSpec>The groups’ semantics, in the scheduler’s order.
field_addresses: Option<BTreeMap<String, u64>>The fields’ landing addresses, on an endpoint’s contract; absent in the rank-independent bootstrap layout.
Implementations§
Source§impl Contract
impl Contract
Sourcepub fn from_wire(raw: &[u8]) -> Result<Self, LayoutError>
pub fn from_wire(raw: &[u8]) -> Result<Self, LayoutError>
Parse a contract off the wire (CacheTransferContract.from_wire_bytes).
Sourcepub fn new(
plan: Plan,
group_specs: Vec<GroupSpec>,
partitions: Vec<(String, Partition)>,
field_addresses: Option<BTreeMap<String, u64>>,
) -> Result<Self, LayoutError>
pub fn new( plan: Plan, group_specs: Vec<GroupSpec>, partitions: Vec<(String, Partition)>, field_addresses: Option<BTreeMap<String, u64>>, ) -> Result<Self, LayoutError>
A contract from its parts, checked as the Python constructor checks it.
Sourcepub fn without_addresses(&self) -> Self
pub fn without_addresses(&self) -> Self
The same contract without its landing addresses: the logical layout every rank of a node registers with the bootstrap server.
Sourcepub fn group_spec(&self, group_id: &str) -> Result<&GroupSpec, LayoutError>
pub fn group_spec(&self, group_id: &str) -> Result<&GroupSpec, LayoutError>
The group’s semantics.
Sourcepub fn group(&self, group_id: &str) -> Result<&GroupLayout, LayoutError>
pub fn group(&self, group_id: &str) -> Result<&GroupLayout, LayoutError>
The group’s geometry.
Sourcepub fn field(&self, field_id: &str) -> Result<&FieldLayout, LayoutError>
pub fn field(&self, field_id: &str) -> Result<&FieldLayout, LayoutError>
A field’s geometry.
Sourcepub fn fields_for_group(&self, group_id: &str) -> Vec<&FieldLayout>
pub fn fields_for_group(&self, group_id: &str) -> Vec<&FieldLayout>
The group’s fields, sorted by field id (fields_for_group).
Sourcepub fn shard_count(&self, group_id: &str) -> Result<i64, LayoutError>
pub fn shard_count(&self, group_id: &str) -> Result<i64, LayoutError>
The group’s cyclic owner count; one means replicated.
Sourcepub fn virtual_block_count(&self, group_id: &str) -> Result<i64, LayoutError>
pub fn virtual_block_count(&self, group_id: &str) -> Result<i64, LayoutError>
The exclusive bound of the scheduler block ids a manifest of the
group may carry (virtual_block_count).
Sourcepub fn partition_for(&self, field_id: &str) -> Option<&Partition>
pub fn partition_for(&self, field_id: &str) -> Option<&Partition>
A field’s TP partition, if it has one.
Sourcepub fn field_page_byte_offset(
&self,
field_id: &str,
page_id: i64,
) -> Result<i64, LayoutError>
pub fn field_page_byte_offset( &self, field_id: &str, page_id: i64, ) -> Result<i64, LayoutError>
One field page’s byte offset in the arena (field_page_byte_offset).
Sourcepub fn field_address(
&self,
base: u64,
field_id: &str,
) -> Result<i128, LayoutError>
pub fn field_address( &self, base: u64, field_id: &str, ) -> Result<i128, LayoutError>
Where a field’s page 0 lands for an arena at base: its advertised
address on an endpoint’s contract, else base plus its offset.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Contract
impl RefUnwindSafe for Contract
impl Send for Contract
impl Sync for Contract
impl Unpin for Contract
impl UnsafeUnpin for Contract
impl UnwindSafe for Contract
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self with key and returns true if they are equal.