From d4d32bcc1118c00602cbd18330fdaee5c77489b9 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 7 Jan 2021 04:56:07 +0900 Subject: [PATCH] Define ACTOR_SYS and POST_CHAN --- plume-models/src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plume-models/src/lib.rs b/plume-models/src/lib.rs index be7cf4b6..5a751877 100755 --- a/plume-models/src/lib.rs +++ b/plume-models/src/lib.rs @@ -17,7 +17,10 @@ extern crate serde_json; #[macro_use] extern crate tantivy; +use once_cell::sync::Lazy; use plume_common::activity_pub::inbox::InboxError; +use posts::PostEvent; +use riker::actors::{channel, ActorSystem, ChannelRef, SystemBuilder}; #[cfg(not(any(feature = "sqlite", feature = "postgres")))] compile_error!("Either feature \"sqlite\" or \"postgres\" must be enabled for this crate."); @@ -30,6 +33,16 @@ pub type Connection = diesel::SqliteConnection; #[cfg(all(not(feature = "sqlite"), feature = "postgres"))] pub type Connection = diesel::PgConnection; +pub(crate) static ACTOR_SYS: Lazy = Lazy::new(|| { + SystemBuilder::new() + .name("plume") + .create() + .expect("Failed to create actor system") +}); + +pub(crate) static POST_CHAN: Lazy> = + Lazy::new(|| channel("post_events", &*ACTOR_SYS).expect("Failed to create post channel")); + /// All the possible errors that can be encoutered in this crate #[derive(Debug)] pub enum Error {