1.33 日志通用查询
This commit is contained in:
parent
beb2cd6544
commit
af53992713
@ -0,0 +1,60 @@
|
|||||||
|
package com.qqchen.deploy.backend.framework.websocket.log;
|
||||||
|
|
||||||
|
import com.qqchen.deploy.backend.deploy.enums.RuntimeTypeEnum;
|
||||||
|
import org.springframework.web.socket.WebSocketSession;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志流策略接口
|
||||||
|
* 定义不同运行时类型的日志流获取方式
|
||||||
|
*
|
||||||
|
* @author Framework
|
||||||
|
* @since 2025-12-16
|
||||||
|
*/
|
||||||
|
public interface ILogStreamStrategy {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支持的运行时类型
|
||||||
|
*
|
||||||
|
* @return 运行时类型
|
||||||
|
*/
|
||||||
|
RuntimeTypeEnum supportedType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行日志流推送
|
||||||
|
* 此方法应该持续读取日志并通过callback推送到前端
|
||||||
|
*
|
||||||
|
* @param session WebSocket会话
|
||||||
|
* @param target 日志流目标信息
|
||||||
|
* @param paused 暂停标志(实现应定期检查此标志)
|
||||||
|
* @param callback 日志行回调接口
|
||||||
|
* @throws Exception 流式推送失败时抛出
|
||||||
|
*/
|
||||||
|
void streamLogs(WebSocketSession session,
|
||||||
|
LogStreamTarget target,
|
||||||
|
AtomicBoolean paused,
|
||||||
|
LogLineCallback callback) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停止日志流并清理资源
|
||||||
|
* 当WebSocket连接关闭时调用,确保SSH连接等资源被正确释放
|
||||||
|
*
|
||||||
|
* @param sessionId WebSocket会话ID
|
||||||
|
*/
|
||||||
|
void stop(String sessionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志行回调接口
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
interface LogLineCallback {
|
||||||
|
/**
|
||||||
|
* 发送日志行
|
||||||
|
*
|
||||||
|
* @param timestamp 时间戳
|
||||||
|
* @param content 日志内容
|
||||||
|
*/
|
||||||
|
void sendLogLine(String timestamp, String content);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user