Base未来会话(Session)服务(Service)

Java-friendly base for implementing a SessionService. Every method of the engine interface is suspend; this base final-overrides each and asks the Java subclass for a CompletableFuture instead. Return each future promptly and do any blocking work inside it, not before returning it. The methods with default bodies (closeSession, appendEvent, flush) keep those defaults reachable: leave the hook unoverridden and the engine's own behaviour runs.

构造函数(Constructors)

Link copied to clipboard
constructor()

函数

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

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

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

关闭会话。

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

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

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

删除特定的会话。

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

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

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

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

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

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

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

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