Implement more persistency logic

This commit is contained in:
2019-05-03 11:19:34 +02:00
parent f5dcd52454
commit 96c2864a07
4 changed files with 84 additions and 33 deletions

View File

@ -1,12 +1,5 @@
use crate::model::*;
pub enum ReplaceTextureStatus {
// Call Again With Texture Binary
NeedTextureData(Sha256),
// Done.
Ok,
}
pub type ProtocolResult<T> = Result<T, ProtocolError>;
pub enum ProtocolError {
BadRequest(String),

View File

@ -109,6 +109,10 @@ where
panic!("Contract Violation: handler must not return NeedTextureData \
when data is given.");
}
Ok(ReplaceTextureStatus::Conflict) => {
connection
.send(&Package::Error(409, "Conflict".to_string()))?;
}
Err(err) => {
connection.send(&Package::from(err))?;
}
@ -125,6 +129,9 @@ where
}
}
}
Ok(ReplaceTextureStatus::Conflict) => {
connection.send(&Package::Error(409, "Conflict".to_string()))?;
}
Err(err) => {
connection.send(&Package::from(err))?;
}