type setting struct

This commit is contained in:
Marin Postma
2021-05-10 17:30:09 +02:00
parent 998d5ead34
commit 706643dfed
11 changed files with 47 additions and 29 deletions

View File

@ -10,7 +10,7 @@ use tokio::sync::mpsc;
use tokio::task::spawn_blocking;
use uuid::Uuid;
use crate::index::{Document, SearchQuery, SearchResult, Settings};
use crate::index::{Checked, Document, SearchQuery, SearchResult, Settings};
use crate::index_controller::{
get_arc_ownership_blocking, update_handler::UpdateHandler, Failed, IndexStats, Processed,
Processing,
@ -164,7 +164,7 @@ impl<S: IndexStore + Sync + Send> IndexActor<S> {
.map_err(|e| IndexError::Error(e.into()))
}
async fn handle_settings(&self, uuid: Uuid) -> IndexResult<Settings> {
async fn handle_settings(&self, uuid: Uuid) -> IndexResult<Settings<Checked>> {
let index = self
.store
.get(uuid)

View File

@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
use tokio::sync::{mpsc, oneshot};
use uuid::Uuid;
use crate::index_controller::{IndexSettings, IndexStats, Processing};
use crate::{index::Checked, index_controller::{IndexSettings, IndexStats, Processing}};
use crate::{
index::{Document, SearchQuery, SearchResult, Settings},
index_controller::{Failed, Processed},
@ -57,7 +57,7 @@ impl IndexActorHandle for IndexActorHandleImpl {
Ok(receiver.await.expect("IndexActor has been killed")?)
}
async fn settings(&self, uuid: Uuid) -> IndexResult<Settings> {
async fn settings(&self, uuid: Uuid) -> IndexResult<Settings<Checked>> {
let (ret, receiver) = oneshot::channel();
let msg = IndexMsg::Settings { uuid, ret };
let _ = self.sender.send(msg).await;

View File

@ -3,7 +3,7 @@ use std::path::PathBuf;
use tokio::sync::oneshot;
use uuid::Uuid;
use crate::index::{Document, SearchQuery, SearchResult, Settings};
use crate::index::{Document, SearchQuery, SearchResult, Settings, Checked};
use crate::index_controller::{Failed, IndexStats, Processed, Processing};
use super::{IndexMeta, IndexResult, IndexSettings};
@ -27,7 +27,7 @@ pub enum IndexMsg {
},
Settings {
uuid: Uuid,
ret: oneshot::Sender<IndexResult<Settings>>,
ret: oneshot::Sender<IndexResult<Settings<Checked>>>,
},
Documents {
uuid: Uuid,

View File

@ -14,7 +14,7 @@ pub use handle_impl::IndexActorHandleImpl;
use message::IndexMsg;
use store::{IndexStore, MapIndexStore};
use crate::index::{Document, Index, SearchQuery, SearchResult, Settings};
use crate::index::{Checked, Document, Index, SearchQuery, SearchResult, Settings};
use crate::index_controller::{Failed, Processed, Processing, IndexStats};
use super::IndexSettings;
@ -74,7 +74,7 @@ pub trait IndexActorHandle {
data: Option<File>,
) -> anyhow::Result<Result<Processed, Failed>>;
async fn search(&self, uuid: Uuid, query: SearchQuery) -> IndexResult<SearchResult>;
async fn settings(&self, uuid: Uuid) -> IndexResult<Settings>;
async fn settings(&self, uuid: Uuid) -> IndexResult<Settings<Checked>>;
async fn documents(
&self,
@ -130,7 +130,7 @@ mod test {
self.as_ref().search(uuid, query).await
}
async fn settings(&self, uuid: Uuid) -> IndexResult<Settings> {
async fn settings(&self, uuid: Uuid) -> IndexResult<Settings<Checked>> {
self.as_ref().settings(uuid).await
}