use std::{
borrow::Cow,
cell::RefCell,
marker::PhantomData,
pin, str,
sync::Arc,
task::{self, Poll},
time::Duration,
};
use arc_swap::ArcSwapOption;
use futures::{Future, FutureExt, Stream, StreamExt, ready};
use libp2p::PeerId;
use tokio::sync::{mpsc, oneshot};
use crate::{
Actor,
actor::{ActorId, ActorRef, RemoteActorRef},
error::{ActorStopReason, Infallible, RegistryError, RemoteSendError},
};
use super::{
DowncastRegsiteredActorRefError, REMOTE_REGISTRY, RemoteActor, RemoteRegistryActorRef,
messaging::SwarmResponse,
registry::{
ActorRegistration, LookupLocalReply, LookupReply, LookupResult, RegisterReply,
UnregisterReply,
},
};
static ACTOR_SWARM: ArcSwapOption<ActorSwarm> = ArcSwapOption::const_empty();
thread_local! {
static THREAD_LOCAL_SWARM: RefCell<Option<Arc<ActorSwarm>>> = const { RefCell::new(None) };
}
#[derive(Debug)]
pub(crate) struct ActorSwarm {
swarm_tx: SwarmSender,
local_peer_id: PeerId,
}
include!("swarm/actor_swarm.rs");
include!("swarm/lookup_stream.rs");
include!("swarm/commands.rs");
include!("swarm/tests.rs");