pub struct SessionService { /* private fields */ }Expand description
Stable programmatic facade for session lifecycle operations.
Implementations§
Source§impl SessionService
impl SessionService
Sourcepub fn new(backend: Arc<dyn SessionBackend>) -> Self
pub fn new(backend: Arc<dyn SessionBackend>) -> Self
Creates an owned session capability backed by a shared host handle.
Sourcepub async fn create_session(
&self,
request: CreateSessionRequest,
) -> Result<SessionId, SessionError>
pub async fn create_session( &self, request: CreateSessionRequest, ) -> Result<SessionId, SessionError>
Creates one session and returns its stable identifier.
§Errors
Returns an error when the host cannot create the requested session.
Sourcepub async fn get_session(
&self,
session_id: &SessionId,
) -> Result<Option<Session>, SessionError>
pub async fn get_session( &self, session_id: &SessionId, ) -> Result<Option<Session>, SessionError>
Loads one complete session aggregate by identifier.
§Errors
Returns an error when persisted data cannot be loaded or decoded.
Sourcepub async fn send_message(
&self,
session_id: &SessionId,
message: impl Into<String> + Send,
) -> Result<(), SessionError>
pub async fn send_message( &self, session_id: &SessionId, message: impl Into<String> + Send, ) -> Result<(), SessionError>
Sends a text message to one session.
§Errors
Returns an error when the session cannot accept or enqueue the message.
Sourcepub async fn submit_coordinator_message(
&self,
session_id: &SessionId,
request: CoordinatorMessageRequest,
) -> Result<(), SessionError>
pub async fn submit_coordinator_message( &self, session_id: &SessionId, request: CoordinatorMessageRequest, ) -> Result<(), SessionError>
Submits one coordinator-owned turn directly to the serialized worker.
§Errors
Returns an error when the session is busy or cannot accept the turn.
Sourcepub async fn answer_questions(
&self,
session_id: &SessionId,
request: AnswerQuestionsRequest,
) -> Result<(), SessionError>
pub async fn answer_questions( &self, session_id: &SessionId, request: AnswerQuestionsRequest, ) -> Result<(), SessionError>
Answers the complete current clarification-question set.
§Errors
Returns an error when the answers are stale, incomplete, or cannot be enqueued as a follow-up turn.
Sourcepub async fn cancel_session(
&self,
session_id: &SessionId,
) -> Result<(), SessionError>
pub async fn cancel_session( &self, session_id: &SessionId, ) -> Result<(), SessionError>
Cancels one session through its host lifecycle workflow.
§Errors
Returns an error when the session does not exist or cannot be canceled in its current state.
Sourcepub async fn merge_session(
&self,
session_id: &SessionId,
) -> Result<(), SessionError>
pub async fn merge_session( &self, session_id: &SessionId, ) -> Result<(), SessionError>
Requests merge processing for one session.
§Errors
Returns an error when the session is not mergeable or queueing fails.
Sourcepub async fn create_review_request(
&self,
session_id: &SessionId,
) -> Result<ReviewRequest, SessionError>
pub async fn create_review_request( &self, session_id: &SessionId, ) -> Result<ReviewRequest, SessionError>
Queues publication of one session and creates or refreshes its review request.
§Errors
Returns an error when queueing, branch publication, forge access, or persistence fails.