Skip to content

Conversation

KirCute
Copy link
Contributor

@KirCute KirCute commented Aug 25, 2025

Description / 描述

添加了一个将文件划分为限制了大小的若干块的驱动,除第一块的名称与原文件名保持一致外,其余块的名称为原文件名称 + .openlist_chunk_<块号>,支持在其后继续添加自定义后缀以应对蓝奏云对文件类型的限制。

这是一个与aliascrypt类似的中间件驱动,调用该驱动的List方法得到的文件列表会过滤掉具有.openlist_chunk后缀的项目,且被分片的文件的大小为所有分片大小之和,调用Link方法得到的是一个拼接了所有分片的RangeReader

对于一个已经创建好且其中有分片文件的chunk驱动,修改其分片大小是安全的,曾经的文件仍可以正常访问、重命名、复制、移动和删除;但修改其自定义后缀是不安全的,不确定会出现什么样的问题。

Motivation and Context / 背景

Closes #1074

How Has This Been Tested? / 测试

测试了后端存储为localusslanzou的情况,暂时没有发现问题

Checklist / 检查清单

  • I have read the CONTRIBUTING document.
    我已阅读 CONTRIBUTING 文档。
  • I have formatted my code with go fmt or prettier.
    我已使用 go fmtprettier 格式化提交的代码。
  • I have added appropriate labels to this PR (or mentioned needed labels in the description if lacking permissions).
    我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
  • I have requested review from relevant code authors using the "Request review" feature when applicable.
    我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
  • I have updated the repository accordingly (If it’s needed).
    我已相应更新了相关仓库(若适用)。

@KirCute KirCute added enhancement 增强/功能请求 go Pull requests that update go code labels Aug 25, 2025
@KirCute KirCute changed the title feat(chunk): add a driver that divides large files into multiple chunks feat(driver): add a driver that divides large files into multiple chunks Aug 25, 2025
@KirCute KirCute changed the title feat(driver): add a driver that divides large files into multiple chunks feat(drivers): add a driver that divides large files into multiple chunks Aug 25, 2025
@ILoveScratch2 ILoveScratch2 requested a review from Copilot August 26, 2025 10:49
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new "chunk" driver that splits large files into multiple smaller parts with size limitations. The driver acts as middleware similar to the existing alias and crypt drivers, filtering chunk files from listings and providing a unified RangeReader that concatenates all chunks when accessing files.

  • Adds a complete chunk driver implementation with file splitting/merging capabilities
  • Implements all standard driver operations (List, Link, Move, Rename, Copy, Remove, Put) with chunk-aware logic
  • Registers the new driver in the driver registry

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
drivers/chunk/meta.go Driver metadata and configuration with Addition struct defining chunk parameters
drivers/chunk/driver.go Complete driver implementation handling file chunking operations and range reading
drivers/all.go Registration of the new chunk driver import

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 增强/功能请求 go Pull requests that update go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] 建议增加类似rclone的chunker的文件分块存储功能
1 participant