Skip to content

Commit

Permalink
move sharding module to crate root
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonHartley committed Feb 11, 2024
1 parent e43fe5f commit bad8238
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 30 deletions.
2 changes: 2 additions & 0 deletions coerce/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,7 @@ pub mod remote;

#[cfg(feature = "sharding")]
pub mod sharding;
#[cfg(feature = "singleton")]
pub mod singleton;

pub(crate) const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
2 changes: 0 additions & 2 deletions coerce/src/remote/cluster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ pub mod client;
pub mod discovery;
pub mod node;

#[cfg(feature = "singleton")]
pub mod singleton;
2 changes: 1 addition & 1 deletion coerce/src/sharding/coordinator/factory.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::actor::LocalActorRef;
use crate::remote::cluster::singleton::factory::SingletonFactory;
use crate::singleton::factory::SingletonFactory;
use crate::sharding::coordinator::ShardCoordinator;
use crate::sharding::host::ShardHost;

Expand Down
4 changes: 2 additions & 2 deletions coerce/src/sharding/host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use std::collections::hash_map::Entry;
use std::collections::{HashMap, VecDeque};

use crate::actor::scheduler::ActorType;
use crate::remote::cluster::singleton::factory::SingletonFactory;
use crate::remote::cluster::singleton::Singleton;
use crate::singleton::factory::SingletonFactory;
use crate::singleton::Singleton;
use crate::sharding::coordinator::factory::CoordinatorFactory;
use uuid::Uuid;

Expand Down
2 changes: 1 addition & 1 deletion coerce/src/sharding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::actor::{
use std::error::Error;
use std::fmt::{Display, Formatter};

use crate::remote::cluster::singleton::{singleton, Singleton, SingletonBuilder};
use crate::singleton::{singleton, Singleton, SingletonBuilder};
use crate::remote::system::builder::RemoteSystemConfigBuilder;
use crate::remote::system::RemoteActorSystem;
use crate::sharding::coordinator::allocation::AllocateShard;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use crate::actor::message::{
FromBytes, Handler, Message, MessageUnwrapErr, MessageWrapErr, ToBytes,
};
use crate::actor::Actor;
use crate::remote::cluster::singleton::factory::SingletonFactory;
use crate::remote::cluster::singleton::manager::status::SingletonState;
use crate::remote::cluster::singleton::manager::{Manager, State};
use crate::remote::cluster::singleton::proto::singleton as proto;
use crate::singleton::factory::SingletonFactory;
use crate::singleton::manager::status::SingletonState;
use crate::singleton::manager::{Manager, State};
use crate::singleton::proto::singleton as proto;
use crate::remote::system::{NodeId, RemoteActorSystem};

#[derive(Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ use crate::actor::message::{
};
use crate::actor::{Actor, ActorFactory, ActorId, ActorRef, IntoActor, LocalActorRef, ToActorId};
use crate::remote::cluster::node::NodeSelector;
use crate::remote::cluster::singleton::factory::SingletonFactory;
use crate::remote::cluster::singleton::manager::lease::{LeaseAck, RequestLease};
use crate::remote::cluster::singleton::proxy::Proxy;
use crate::remote::cluster::singleton::{proto, proxy};
use crate::singleton::factory::SingletonFactory;
use crate::singleton::manager::lease::{LeaseAck, RequestLease};
use crate::singleton::proxy::Proxy;
use crate::singleton::{proto, proxy};
use crate::remote::stream::pubsub::{PubSub, Receive, Subscription};
use crate::remote::stream::system::{ClusterEvent, ClusterMemberUp, SystemEvent, SystemTopic};
use crate::remote::system::{NodeId, RemoteActorSystem};
Expand Down Expand Up @@ -370,6 +370,7 @@ impl<F: SingletonFactory> Handler<Receive<SystemTopic>> for Manager<F> {
ClusterEvent::NodeRemoved(node) => {
self.managers.remove(&node.id);

debug!(node_id = node.id, "node removed");
if !self.state.is_joining() {
if let State::Starting { acknowledged_nodes } = &mut self.state {
acknowledged_nodes.remove(&node.id);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::actor::context::ActorContext;
use crate::actor::message::{Handler, Message};
use crate::actor::{Actor, ActorRefErr, IntoActor, LocalActorRef, PipeTo};
use crate::remote::cluster::singleton::factory::SingletonFactory;
use crate::remote::cluster::singleton::manager::{Manager, SingletonStarted, State};
use crate::remote::cluster::singleton::proxy;
use crate::singleton::factory::SingletonFactory;
use crate::singleton::manager::{Manager, SingletonStarted, State};
use crate::singleton::proxy;

pub enum ActorStartResult<A: Actor> {
Started(LocalActorRef<A>),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use crate::actor::context::ActorContext;
use crate::actor::message::{
FromBytes, Handler, Message, MessageUnwrapErr, MessageWrapErr, ToBytes,
};
use crate::remote::cluster::singleton::factory::SingletonFactory;
use crate::remote::cluster::singleton::manager::{Manager, State};
use crate::remote::cluster::singleton::proto::singleton as proto;
use crate::singleton::factory::SingletonFactory;
use crate::singleton::manager::{Manager, State};
use crate::singleton::proto::singleton as proto;
use crate::remote::system::NodeId;
use protobuf::EnumOrUnknown;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use crate::actor::{
Actor, ActorFactory, ActorId, ActorRefErr, IntoActor, IntoActorId, LocalActorRef, ToActorId,
};
use crate::remote::cluster::node::NodeSelector;
use crate::remote::cluster::singleton::factory::SingletonFactory;
use crate::remote::cluster::singleton::manager::lease::{LeaseAck, RequestLease};
use crate::remote::cluster::singleton::manager::{Manager, SingletonStarted, SingletonStopped};
use crate::remote::cluster::singleton::proxy::send::Deliver;
use crate::remote::cluster::singleton::proxy::Proxy;
use crate::singleton::factory::SingletonFactory;
use crate::singleton::manager::lease::{LeaseAck, RequestLease};
use crate::singleton::manager::{Manager, SingletonStarted, SingletonStopped};
use crate::singleton::proxy::send::Deliver;
use crate::singleton::proxy::Proxy;
use crate::remote::system::builder::RemoteSystemConfigBuilder;
use crate::remote::system::RemoteActorSystem;
use tokio::sync::oneshot;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::actor::context::ActorContext;
use crate::actor::message::{Handler, Message};
use crate::actor::{Actor, ActorRef, ToActorId};
use crate::remote::cluster::singleton::proxy::send::Buffered;
use crate::singleton::proxy::send::Buffered;
use std::collections::VecDeque;

pub mod send;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::actor::context::ActorContext;
use crate::actor::message::{Handler, Message};
use crate::actor::{Actor, ActorRef, ActorRefErr};
use crate::remote::cluster::singleton::factory::SingletonFactory;
use crate::remote::cluster::singleton::proxy::{Proxy, ProxyState};
use crate::singleton::factory::SingletonFactory;
use crate::singleton::proxy::{Proxy, ProxyState};
use tokio::sync::oneshot::Sender;

pub struct Deliver<M: Message> {
Expand Down
4 changes: 2 additions & 2 deletions coerce/tests/test_cluster_singleton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use coerce::actor::message::{Handler, Message, MessageUnwrapErr, MessageWrapErr}
use coerce::actor::system::builder::ActorSystemBuilder;
use coerce::actor::system::ActorSystem;
use coerce::actor::Actor;
use coerce::remote::cluster::singleton::factory::SingletonFactory;
use coerce::remote::cluster::singleton::{singleton, SingletonBuilder};
use coerce::singleton::factory::SingletonFactory;
use coerce::singleton::{singleton, SingletonBuilder};
use coerce::remote::system::RemoteActorSystem;
use std::time::Duration;
use tokio::time::sleep;
Expand Down

0 comments on commit bad8238

Please sign in to comment.