feat: 新增冷热数据访问分离逻辑
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# 热数据同步配置
|
||||
zlt:
|
||||
storage:
|
||||
# 热数据同步配置
|
||||
hot-sync:
|
||||
enabled: true # 是否启用热数据同步
|
||||
batch-size: 100 # 批次大小
|
||||
interval-minutes: 30 # 同步间隔(分钟)
|
||||
access-threshold: 10 # 访问次数阈值
|
||||
max-threads: 5 # 最大线程数
|
||||
|
||||
# 同步定时任务配置
|
||||
sync:
|
||||
schedule:
|
||||
enabled: true # 是否启用定时任务
|
||||
cron: "0 0 2 * * ?" # 每日同步时间(默认凌晨2点)
|
||||
status-check:
|
||||
cron: "0 0 * * * ?" # 状态检查时间(每小时)
|
||||
|
||||
# 迁移配置
|
||||
migration:
|
||||
enable-verification: true # 是否启用迁移验证
|
||||
delete-source: false # 迁移后是否删除源文件
|
||||
@@ -53,6 +53,19 @@ zlt:
|
||||
enable-verification: true # 启用迁移验证
|
||||
delete-source: false # 迁移后是否删除源文件
|
||||
batch-size: 100 # 迁移批次大小
|
||||
hot-sync:
|
||||
enabled: true # 启用热数据同步
|
||||
batch-size: 100 # 批次大小
|
||||
interval-minutes: 30 # 同步间隔
|
||||
access-threshold: 10 # 访问次数阈值
|
||||
max-threads: 5 # 最大线程数
|
||||
|
||||
sync:
|
||||
schedule:
|
||||
enabled: true # 启用定时任务
|
||||
cron: "0 0 2 * * ?" # 每日同步时间
|
||||
status-check:
|
||||
cron: "0 0 * * * ?" # 状态检查时间
|
||||
#多租户配置
|
||||
tenant:
|
||||
enable: false
|
||||
|
||||
@@ -29,4 +29,55 @@
|
||||
<select id="findById" resultType="com.central.common.model.FileInfo">
|
||||
SELECT * FROM file_info WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 查询文件列表 -->
|
||||
<select id="findList" resultType="com.central.common.model.FileInfo">
|
||||
SELECT * FROM file_info
|
||||
<where>
|
||||
<if test="params.name != null and params.name != ''">
|
||||
AND name LIKE CONCAT('%', #{params.name}, '%')
|
||||
</if>
|
||||
<if test="params.contentType != null and params.contentType != ''">
|
||||
AND content_type LIKE CONCAT('%', #{params.contentType}, '%')
|
||||
</if>
|
||||
<if test="params.storageType != null and params.storageType != ''">
|
||||
AND storage_type = #{params.storageType}
|
||||
</if>
|
||||
<if test="params.isImg != null">
|
||||
AND is_img = #{params.isImg}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY createTime DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询热数据文件列表 -->
|
||||
<select id="selectHotDataFiles" resultType="com.central.common.model.FileInfo">
|
||||
SELECT * FROM file_info
|
||||
WHERE create_time >= #{hotDataThreshold}
|
||||
AND size > 0
|
||||
AND (storage_type IS NULL OR storage_type NOT LIKE '%S3%' OR storage_type NOT LIKE '%MINIO%')
|
||||
AND (path IS NULL OR path NOT LIKE '%s3://%' OR path NOT LIKE '%minio%')
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{limit}
|
||||
</select>
|
||||
|
||||
<!-- 根据存储类型查询文件 -->
|
||||
<select id="selectFilesByStorageType" resultType="com.central.common.model.FileInfo">
|
||||
SELECT * FROM file_info
|
||||
WHERE storage_type = #{storageType}
|
||||
AND size > 0
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{limit}
|
||||
</select>
|
||||
|
||||
<!-- 查询需要同步的文件(不在S3中的OSS文件) -->
|
||||
<select id="selectFilesNeedSync" resultType="com.central.common.model.FileInfo">
|
||||
SELECT * FROM file_info
|
||||
WHERE (storage_type IS NULL OR storage_type NOT LIKE '%S3%' OR storage_type NOT LIKE '%MINIO%')
|
||||
AND (path IS NULL OR path NOT LIKE '%s3://%' OR path NOT LIKE '%minio%')
|
||||
AND size > 0
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{limit}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user