pub struct Session {
pub id: String,
pub graph_id: String,
pub current_task_id: String,
pub status_message: Option<String>,
pub context: Context,
pub version: u64,
}Expand description
Session information
Sessions carry an optimistic-locking version: storage backends reject a
save whose version does not match the stored one (see
GraphError::SessionConflict), so concurrent runs of the same session
fail loudly instead of silently losing updates.
Fields§
§id: String§graph_id: String§current_task_id: String§status_message: Option<String>Optional status message from the last executed task
context: Context§version: u64Optimistic-locking version, incremented by storage on every successful save. Defaults to 0 for new / pre-0.6 sessions.
Implementations§
Source§impl Session
impl Session
Sourcepub fn new_from_task(sid: String, task_name: &str) -> Self
pub fn new_from_task(sid: String, task_name: &str) -> Self
Create a new session positioned at the given task.
graph_id defaults to "default"; use Session::with_graph_id if
you store multiple graphs.
Sourcepub fn with_graph_id(self, graph_id: impl Into<String>) -> Self
pub fn with_graph_id(self, graph_id: impl Into<String>) -> Self
Set the graph this session belongs to.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for Session
impl !UnwindSafe for Session
impl Freeze for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more