Define SearchActor::init()

This commit is contained in:
Kitaiti Makoto 2021-01-07 04:56:25 +09:00
parent d4d32bcc11
commit 1bfed0294f

View File

@ -1,6 +1,6 @@
use super::Searcher;
use crate::{db_conn::DbPool, posts::PostEvent, POST_CHAN};
use riker::actors::{Actor, ActorFactoryArgs, Context, Sender, Subscribe, Tell};
use crate::{db_conn::DbPool, posts::PostEvent, ACTOR_SYS, POST_CHAN};
use riker::actors::{Actor, ActorFactoryArgs, ActorRefFactory, Context, Sender, Subscribe, Tell};
use std::sync::Arc;
use tracing::error;
@ -9,6 +9,12 @@ pub struct SearchActor {
conn: DbPool,
}
impl SearchActor {
pub fn init(searcher: Arc<Searcher>, conn: DbPool) {
ACTOR_SYS.actor_of_args::<SearchActor, _>("search", (searcher, conn)).expect("Failed to initialize searcher actor");
}
}
impl Actor for SearchActor {
type Msg = PostEvent;