mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-23 03:51:00 +00:00
Define ACTOR_SYS and POST_CHAN
This commit is contained in:
parent
0a148721de
commit
d4d32bcc11
1 changed files with 13 additions and 0 deletions
|
@ -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<ActorSystem> = Lazy::new(|| {
|
||||
SystemBuilder::new()
|
||||
.name("plume")
|
||||
.create()
|
||||
.expect("Failed to create actor system")
|
||||
});
|
||||
|
||||
pub(crate) static POST_CHAN: Lazy<ChannelRef<PostEvent>> =
|
||||
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 {
|
||||
|
|
Loading…
Reference in a new issue