会话(Session)服务(Service)

interface SessionService

Defines the contract for managing Sessions and their associated Events. Provides methods for creating, retrieving, listing, and deleting sessions, as well as listing and appending events to a session. Implementations of this interface handle the underlying storage and retrieval logic.

Inheritors

函数

Link copied to clipboard
open suspend fun appendEvent(session: Session, event: Event): Event

追加(数据) 事件 给……;发送到…… session将该状态变化(即 “状态增量”)应用到内存中的会话数据中,并记录这一事件。 temp: 这些键会被应用到内存中的状态数据上(这样后续参与调用的代理程序就可以读取这些数据),但之后会从内存中删除这些键。 事件 在数据被持久化(即存储到数据库中)之前。

Link copied to clipboard
open suspend fun closeSession(session: Session)

关闭会话。

Link copied to clipboard
abstract suspend fun createSession(key: SessionKey, state: Map<String, Any>? = null): Session

使用指定的参数创建一个新的会话。

Link copied to clipboard
abstract suspend fun deleteSession(key: SessionKey)

删除特定的会话。

Link copied to clipboard
open suspend fun flush(key: SessionKey? = null)

在此调用之前,系统会等待所有要写入的数据被追加完成后再进行持久化处理。具体来说,就是那些需要被写入的数据…… key或者,在每次会话开始时(即每次用户登录时)…… key 是 null取消呼叫者的操作会停止等待过程,但不会影响数据的写入操作。

Link copied to clipboard
abstract suspend fun getSession(key: SessionKey, config: GetSessionConfig? = null): Session?

检索特定的会话(session),并可选择性地过滤其中包含的事件(events)。

Link copied to clipboard
abstract suspend fun listEvents(key: SessionKey): ListEventsResponse

列出特定会话中的所有事件。

Link copied to clipboard
abstract suspend fun listSessions(appName: String, userId: String): ListSessionsResponse

列出与特定应用程序和用户关联的会话(session)。