-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tracker, add support for batch jobs
- Loading branch information
1 parent
12af04a
commit 129fa3e
Showing
13 changed files
with
1,514 additions
and
84 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
use crate::proto::single::FaktoryCommand; | ||
use crate::{Batch, Error}; | ||
use std::io::Write; | ||
|
||
impl FaktoryCommand for Batch { | ||
fn issue<W: Write>(&self, w: &mut W) -> Result<(), Error> { | ||
w.write_all(b"BATCH NEW ")?; | ||
serde_json::to_writer(&mut *w, self).map_err(Error::Serialization)?; | ||
Ok(w.write_all(b"\r\n")?) | ||
} | ||
} | ||
|
||
// ---------------------------------------------- | ||
|
||
pub struct CommitBatch(String); | ||
|
||
impl From<String> for CommitBatch { | ||
fn from(value: String) -> Self { | ||
CommitBatch(value) | ||
} | ||
} | ||
|
||
impl FaktoryCommand for CommitBatch { | ||
fn issue<W: Write>(&self, w: &mut W) -> Result<(), Error> { | ||
w.write_all(b"BATCH COMMIT ")?; | ||
w.write_all(self.0.as_bytes())?; | ||
Ok(w.write_all(b"\r\n")?) | ||
} | ||
} | ||
|
||
// ---------------------------------------------- | ||
|
||
pub struct GetBatchStatus(String); | ||
|
||
impl From<String> for GetBatchStatus { | ||
fn from(value: String) -> Self { | ||
GetBatchStatus(value) | ||
} | ||
} | ||
|
||
impl FaktoryCommand for GetBatchStatus { | ||
fn issue<W: Write>(&self, w: &mut W) -> Result<(), Error> { | ||
w.write_all(b"BATCH STATUS ")?; | ||
w.write_all(self.0.as_bytes())?; | ||
Ok(w.write_all(b"\r\n")?) | ||
} | ||
} | ||
|
||
// ---------------------------------------------- | ||
|
||
pub struct OpenBatch(String); | ||
|
||
impl From<String> for OpenBatch { | ||
fn from(value: String) -> Self { | ||
OpenBatch(value) | ||
} | ||
} | ||
|
||
impl FaktoryCommand for OpenBatch { | ||
fn issue<W: Write>(&self, w: &mut W) -> Result<(), Error> { | ||
w.write_all(b"BATCH OPEN ")?; | ||
w.write_all(self.0.as_bytes())?; | ||
Ok(w.write_all(b"\r\n")?) | ||
} | ||
} |
Oops, something went wrong.