pub(crate) struct ActorRegistry {
actors: ActorRegistryType,
script_actors: AtomicRefCell<HashMap<String, String>>,
source_actor_names: AtomicRefCell<HashMap<PipelineId, Vec<String>>>,
inline_source_content: AtomicRefCell<HashMap<PipelineId, String>>,
next: AtomicU32,
}Expand description
A list of known, owned actors.
Fields§
§actors: ActorRegistryType§script_actors: AtomicRefCell<HashMap<String, String>>§source_actor_names: AtomicRefCell<HashMap<PipelineId, Vec<String>>>Lookup table for SourceActor names associated with a given PipelineId.
inline_source_content: AtomicRefCell<HashMap<PipelineId, String>>Lookup table for inline source content associated with a given PipelineId.
next: AtomicU32Implementations§
Source§impl ActorRegistry
impl ActorRegistry
pub(crate) fn cleanup(&self, stream_id: StreamId)
pub fn register_script_actor(&self, script_id: String, actor: String)
pub fn script_to_actor(&self, script_id: String) -> String
pub fn script_actor_registered(&self, script_id: String) -> bool
pub fn actor_to_script(&self, actor: String) -> String
Sourcepub fn base_name<T: Actor>() -> &'static str
pub fn base_name<T: Actor>() -> &'static str
Create a name prefix for each actor type. While not needed for unique ids as each actor already has a different suffix, it can be used to visually identify actors in the logs.
Sourcepub fn new_name<T: Actor>(&self) -> String
pub fn new_name<T: Actor>(&self) -> String
Create a unique name based on a monotonically increasing suffix
TODO: Merge this with register and don’t allow to
create new names without registering an actor.
Sourcepub(crate) fn register<T: Actor>(&self, actor: T)
pub(crate) fn register<T: Actor>(&self, actor: T)
Add an actor to the registry of known actors that can receive messages.
Sourcepub fn find<T: Actor>(&self, name: &str) -> DowncastableActorArc<T>
pub fn find<T: Actor>(&self, name: &str) -> DowncastableActorArc<T>
Find an actor by registered name
Sourcepub fn encode<T: ActorEncode<S>, S: Serialize>(&self, name: &str) -> S
pub fn encode<T: ActorEncode<S>, S: Serialize>(&self, name: &str) -> S
Find an actor by registered name and return its serialization
Sourcepub(crate) fn handle_message(
&self,
msg: &Map<String, Value>,
stream: &mut DevtoolsConnection,
stream_id: StreamId,
) -> Result<(), ()>
pub(crate) fn handle_message( &self, msg: &Map<String, Value>, stream: &mut DevtoolsConnection, stream_id: StreamId, ) -> Result<(), ()>
Attempt to process a message as directed by its to property. If the actor is not found, does not support the
message, or failed to handle the message, send an error reply instead.
pub fn remove(&self, name: String)
pub fn register_source_actor(&self, pipeline_id: PipelineId, actor_name: &str)
pub fn source_actor_names_for_pipeline( &self, pipeline_id: PipelineId, ) -> Vec<String>
pub fn set_inline_source_content( &self, pipeline_id: PipelineId, content: String, )
pub fn inline_source_content(&self, pipeline_id: PipelineId) -> Option<String>
Trait Implementations§
Source§impl Default for ActorRegistry
impl Default for ActorRegistry
Source§fn default() -> ActorRegistry
fn default() -> ActorRegistry
Source§impl MallocSizeOf for ActorRegistry
impl MallocSizeOf for ActorRegistry
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl !Freeze for ActorRegistry
impl !RefUnwindSafe for ActorRegistry
impl Send for ActorRegistry
impl Sync for ActorRegistry
impl Unpin for ActorRegistry
impl !UnwindSafe for ActorRegistry
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
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 more