pub struct ConstantView {
pub peers: Vec<PeerId>,
pub seed: u64,
}Expand description
Fixed-list peer selector. Authors construct with the full peer set at compile time; queries return slices.
Fields§
§peers: Vec<PeerId>The fixed peer set, in insertion order.
seed: u64Deterministic seed for Random selection.
Implementations§
Trait Implementations§
Source§impl AnyComponent for ConstantView
impl AnyComponent for ConstantView
Source§impl Bootstrap for ConstantView
impl Bootstrap for ConstantView
Source§type Error = Infallible
type Error = Infallible
Library-maker-defined error type. Must satisfy the standard
engine error bounds so the framework can box it into the
dispatch error channel.
Source§impl Clone for ConstantView
impl Clone for ConstantView
Source§fn clone(&self) -> ConstantView
fn clone(&self) -> ConstantView
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ConcreteComponent for ConstantView
impl ConcreteComponent for ConstantView
Source§const TYPE_NAME: &'static str = "ConstantView"
const TYPE_NAME: &'static str = "ConstantView"
Stable identifier. Convention:
<crate>::<TypeName>.Source§const PACKAGE: ComponentPackage = ::bytesandbrains::concrete::ComponentPackage::Application
const PACKAGE: ComponentPackage = ::bytesandbrains::concrete::ComponentPackage::Application
Origin tag; defaults to
Application.Source§const DEPENDENCIES: &'static [DependencyDecl]
const DEPENDENCIES: &'static [DependencyDecl]
Sibling components this depends on. Populated by the
bb::Concrete derive from #[bb::depends(...)].Source§type Error = Infallible
type Error = Infallible
Error from
Self::new; use Infallible if construction
can’t fail.Source§impl Debug for ConstantView
impl Debug for ConstantView
Source§impl Default for ConstantView
impl Default for ConstantView
Source§fn default() -> ConstantView
fn default() -> ConstantView
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ConstantView
impl<'de> Deserialize<'de> for ConstantView
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PeerSelector for ConstantView
impl PeerSelector for ConstantView
Source§type Error = ConstantViewError
type Error = ConstantViewError
Library-maker-defined error type.
Source§fn select(
&mut self,
_ctx: &mut RuntimeResourceRef<'_>,
params: SelectParams,
_completion: CompletionHandle<Vec<PeerId>, Self::Error>,
) -> ContractResponse<Vec<PeerId>, Self::Error>
fn select( &mut self, _ctx: &mut RuntimeResourceRef<'_>, params: SelectParams, _completion: CompletionHandle<Vec<PeerId>, Self::Error>, ) -> ContractResponse<Vec<PeerId>, Self::Error>
Generic selection —
params carries selector-specific
config. Concrete impls handle the variants they support
and fail the unsupported ones via ContractResponse::Now
carrying an error. ctx exposes ctx.peers.addresses
(the framework’s AddressBook), the engine’s per-op
runtime surface, and ctx.dependency::<T>(slot) for
reaching any concrete bound via #[depends(...)].Source§fn current_view(
&mut self,
_ctx: &mut RuntimeResourceRef<'_>,
_completion: CompletionHandle<Vec<PeerId>, Self::Error>,
) -> ContractResponse<Vec<PeerId>, Self::Error>
fn current_view( &mut self, _ctx: &mut RuntimeResourceRef<'_>, _completion: CompletionHandle<Vec<PeerId>, Self::Error>, ) -> ContractResponse<Vec<PeerId>, Self::Error>
Snapshot the current view of known peers (owned snapshot —
async serialization needs owned values).
Source§fn sample(
&mut self,
ctx: &mut RuntimeResourceRef<'_>,
n: u32,
completion: CompletionHandle<Vec<PeerId>, Self::Error>,
) -> ContractResponse<Vec<PeerId>, Self::Error>
fn sample( &mut self, ctx: &mut RuntimeResourceRef<'_>, n: u32, completion: CompletionHandle<Vec<PeerId>, Self::Error>, ) -> ContractResponse<Vec<PeerId>, Self::Error>
Sample
n peers from the current view. Calls
land on select(SelectParams::Random { n }) by default.
Concrete impls may override to keep an optimized fast path.Source§impl PeerSelectorRuntime for ConstantView
impl PeerSelectorRuntime for ConstantView
Source§fn atomic_opset(&self) -> AtomicOpsetDecl
fn atomic_opset(&self) -> AtomicOpsetDecl
Atomic-op opset this impl owns.
Source§fn dispatch_atomic(
&mut self,
op_type: &str,
_inputs: &[(&str, &dyn SlotValue)],
_ctx: &mut RuntimeResourceRef<'_>,
) -> Result<DispatchResult, Self::Error>
fn dispatch_atomic( &mut self, op_type: &str, _inputs: &[(&str, &dyn SlotValue)], _ctx: &mut RuntimeResourceRef<'_>, ) -> Result<DispatchResult, Self::Error>
Rust-dispatch entry point for atomic ops.
Auto Trait Implementations§
impl Freeze for ConstantView
impl RefUnwindSafe for ConstantView
impl Send for ConstantView
impl Sync for ConstantView
impl Unpin for ConstantView
impl UnsafeUnpin for ConstantView
impl UnwindSafe for ConstantView
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedComponent for T
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>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> SlotValue for T
impl<T> SlotValue for T
Source§fn into_any_boxed(self: Box<T>) -> Box<dyn Any + Sync + Send>
fn into_any_boxed(self: Box<T>) -> Box<dyn Any + Sync + Send>
Repackage
Box<dyn SlotValue> as Box<dyn Any> for
Box::downcast. Required because the SlotValue and
Any vtables are distinct even though SlotValue: Any.Source§fn clone_boxed(&self) -> Box<dyn SlotValue>
fn clone_boxed(&self) -> Box<dyn SlotValue>
Polymorphic clone preserving the concrete type.
Source§fn to_wire_bytes(&self) -> Result<Vec<u8>, SlotValueError>
fn to_wire_bytes(&self) -> Result<Vec<u8>, SlotValueError>
Wire-boundary encode (bincode + serde). Local forwarding
uses
clone_boxed instead.Source§fn type_hash(&self) -> u64
fn type_hash(&self) -> u64
Stable cross-Node type discriminator. FNV-1a of
std::any::type_name::<T>(); receiver decodes only on a
matching hash.Source§fn runtime_type(&self) -> &'static TypeNode
fn runtime_type(&self) -> &'static TypeNode
Source§fn charged_bytes(&self) -> usize
fn charged_bytes(&self) -> usize
Bytes the carrier owes against
NodeConfig::ingress_byte_budget. Slot-table eviction calls
this to release the charge. Default 0 — only
ingress-derived carriers register a non-zero resolver via
[register_charged_bytes!].