-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(worker): added worker state. #396
Conversation
Related to #375 (Rewrite worker as broker consumer) |
worker/src/state/file.rs
Outdated
|
||
use super::*; | ||
|
||
use cerberus_proto::datatypes::{Task, TaskKind, TaskStatus}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this should be:
use cerberus_proto [...]
use super::*;
worker/src/state/file.rs
Outdated
pub fn new(path: &PathBuf) -> Result<Self, StateError> { | ||
Ok(FileStore { | ||
path: path.clone(), | ||
jobs_path: [&path, &PathBuf::from(JOBS_DIR)].iter().collect(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this use Path::join
?
worker/src/state/mod.rs
Outdated
pub enum StateErrorKind { | ||
#[fail(display = "Failed to connect to state store server.")] | ||
ConnectionFailed, | ||
#[fail(display = "Failed precondition")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error message is too vague.
worker/src/state/mod.rs
Outdated
TaskSerialisationFailed, | ||
#[fail(display = "Failed to deserialise the task proto.")] | ||
TaskDeserialisationFailed, | ||
#[fail(display = "Failed operation.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
worker/src/state/file.rs
Outdated
@@ -23,53 +22,50 @@ impl FileStore { | |||
pub fn new(path: &PathBuf) -> Result<Self, StateError> { | |||
Ok(FileStore { | |||
path: path.clone(), | |||
jobs_path: [&path, &PathBuf::from(JOBS_DIR)].iter().collect(), | |||
jobs_path: path.clone().join(JOBS_DIR), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There shouldn't be a need for clone
before join
as join just takes a reference to self and returns a new object.
480bbd0
to
7a69565
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't rebase during code review.
Sorry, I thought it was only squash that was bad. |
641ef84
to
a4cb87a
Compare
This currently contains one method which manages updating the task and removing the pending tasks.
This currently contains one method which manages updating the task and
removing the pending tasks.
Related to #393