[][src]Struct nature_db::RawTask

pub struct RawTask {
    pub task_id: Vec<u8>,
    pub task_key: String,
    pub task_type: i8,
    pub task_for: String,
    pub task_state: i8,
    pub data: String,
    pub create_time: NaiveDateTime,
    pub execute_time: NaiveDateTime,
    pub retried_times: i16,
}

Fields

task_id: Vec<u8>task_key: Stringtask_type: i8task_for: Stringtask_state: i8data: Stringcreate_time: NaiveDateTimeexecute_time: NaiveDateTimeretried_times: i16

Methods

impl RawTask[src]

pub fn new<T: Serialize + Debug>(
    task: &T,
    task_key: &str,
    task_type: i8,
    task_for: &str
) -> Result<RawTask>
[src]

pub fn finish_old<FI, FD>(
    &mut self,
    old: &RawTask,
    _dao_insert: FI,
    _dao_delete: FD
) -> Result<usize> where
    FI: Fn(&RawTask) -> Result<usize>,
    FD: Fn(&[u8]) -> Result<usize>, 
[src]

for performance reason, one-to-one carry which we can reuse the beginning carry to finish all flows. That way we need not to communicate with DB for create new and delete old carrier. But for failure we must redo from beginning. but I think it has small chance. Another disadvantage is the failure information will be attached to the beginning.

pub fn save_batch<FI, FD>(
    news: &[RawTask],
    old_id: &[u8],
    dao_insert: FI,
    dao_finish: FD
) -> Result<()> where
    FI: Fn(&RawTask) -> Result<usize>,
    FD: Fn(&[u8]) -> Result<usize>, 
[src]

pub fn task_string(&self) -> String[src]

Trait Implementations

impl Clone for RawTask[src]

impl Debug for RawTask[src]

impl<'de> Deserialize<'de> for RawTask[src]

impl<'insert> Insertable<table> for RawTask[src]

type Values = <(Option<Eq<task_id, Vec<u8>>>, Option<Eq<task_key, String>>, Option<Eq<task_type, i8>>, Option<Eq<task_for, String>>, Option<Eq<task_state, i8>>, Option<Eq<data, String>>, Option<Eq<create_time, NaiveDateTime>>, Option<Eq<execute_time, NaiveDateTime>>, Option<Eq<retried_times, i16>>) as Insertable<table>>::Values

The VALUES clause to insert these records Read more

impl<'insert> Insertable<table> for &'insert RawTask[src]

type Values = <(Option<Eq<task_id, &'insert Vec<u8>>>, Option<Eq<task_key, &'insert String>>, Option<Eq<task_type, &'insert i8>>, Option<Eq<task_for, &'insert String>>, Option<Eq<task_state, &'insert i8>>, Option<Eq<data, &'insert String>>, Option<Eq<create_time, &'insert NaiveDateTime>>, Option<Eq<execute_time, &'insert NaiveDateTime>>, Option<Eq<retried_times, &'insert i16>>) as Insertable<table>>::Values

The VALUES clause to insert these records Read more

impl PartialEq<RawTask> for RawTask[src]

impl<__DB: Backend, __ST> Queryable<__ST, __DB> for RawTask where
    (Vec<u8>, String, i8, String, i8, String, NaiveDateTime, NaiveDateTime, i16): Queryable<__ST, __DB>, 
[src]

type Row = <(Vec<u8>, String, i8, String, i8, String, NaiveDateTime, NaiveDateTime, i16) as Queryable<__ST, __DB>>::Row

The Rust type you'd like to map from. Read more

impl<__DB: Backend> QueryableByName<__DB> for RawTask where
    Vec<u8>: FromSql<SqlTypeOf<task_id>, __DB>,
    String: FromSql<SqlTypeOf<task_key>, __DB>,
    i8: FromSql<SqlTypeOf<task_type>, __DB>,
    String: FromSql<SqlTypeOf<task_for>, __DB>,
    i8: FromSql<SqlTypeOf<task_state>, __DB>,
    String: FromSql<SqlTypeOf<data>, __DB>,
    NaiveDateTime: FromSql<SqlTypeOf<create_time>, __DB>,
    NaiveDateTime: FromSql<SqlTypeOf<execute_time>, __DB>,
    i16: FromSql<SqlTypeOf<retried_times>, __DB>, 
[src]

impl Serialize for RawTask[src]

impl StructuralPartialEq for RawTask[src]

impl<'insert> UndecoratedInsertRecord<table> for RawTask[src]

Auto Trait Implementations

impl RefUnwindSafe for RawTask

impl Send for RawTask

impl Sync for RawTask

impl Unpin for RawTask

impl UnwindSafe for RawTask

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoSql for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,