Skip to main content

Session

Struct Session 

Source
pub struct Session { /* private fields */ }
Expand description

Immutable session state created by session_start / session_create.

Cloned (via Arc) into each module. Holds the project root and cross-cutting concerns that every module may need.

alias and last_used_at are interior-mutable (RwLock) so the ledger can rename or touch sessions without invalidating outstanding Arc<Session> handles held by tool handlers.

Implementations§

Source§

impl Session

Source

pub fn new(config: SessionConfig) -> Result<Session, CoreError>

Source

pub fn worktrees_dir(&self) -> &Path

Directory where this session’s git worktrees live.

Absolute path. Resolved once at Session::new from SessionConfig::worktrees_dir → env LDS_WORKTREES_DIR<root>/.worktrees. See SessionConfig::worktrees_dir for the setup expectation (gitignore requirement).

Source

pub fn root(&self) -> &Path

Source

pub fn id(&self) -> &str

Source

pub fn alias(&self) -> Option<String>

Source

pub fn created_at(&self) -> u64

Source

pub fn last_used_at(&self) -> u64

Source

pub fn touch(&self)

Source

pub fn timeout(&self) -> Duration

Source

pub fn max_output(&self) -> usize

Source

pub fn global_recipe_dirs(&self) -> &[PathBuf]

Source

pub fn ensure_alive(&self) -> Result<(), SessionError>

Check that the session root directory still exists.

Call this at each entry point (e.g. list, run) to detect a deleted root before attempting I/O. Returns SessionError::RootGone if the directory no longer exists.

Trait Implementations§

Source§

impl Debug for Session

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more