implement glue code; Server is now startable
Server can now be used. All features except preview and gc should work.
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
use crate::model::*;
|
||||
use crate::persistency::*;
|
||||
use crate::protocol::*;
|
||||
use crate::search::*;
|
||||
|
||||
use std::path::Path;
|
||||
use std::sync::*;
|
||||
@ -20,8 +21,14 @@ impl ServerState {
|
||||
}
|
||||
|
||||
impl ProtocolHandler for ServerState {
|
||||
fn query(&mut self, _query: &[String]) -> ProtocolResult<Vec<Texture>> {
|
||||
unimplemented!()
|
||||
fn query(&mut self, query: &[String]) -> ProtocolResult<Vec<Texture>> {
|
||||
let q = Query::parse(query)
|
||||
.map_err(|e| ProtocolError::BadRequest(format!("Invalid Query String: {:?}", e)))?;
|
||||
|
||||
let data_store = self.data_store.read().unwrap();
|
||||
|
||||
let mut textures = data_store.borrow_textures();
|
||||
Ok(q.search(&mut textures))
|
||||
}
|
||||
|
||||
fn get_texture_by_id(&mut self, id: &str) -> ProtocolResult<Option<Texture>> {
|
||||
|
Reference in New Issue
Block a user