Skip to content

feat(driver): add Azure Blob Storage driver #8261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 3, 2025
Merged

Conversation

NewFuture
Copy link
Contributor

@NewFuture NewFuture commented Mar 30, 2025

Introduce a new driver for Azure Blob storage, enabling integration with Azure's storage services.

This implementation based on azure blob Golang SDK, includes methods for file operations such as upload, delete, and copy, along with batch processing capabilities

tested cases

  • List
  • Put (Upload files)
  • Remove file
  • Remove directory
  • Make directory
  • Move file
  • Move folder
  • Rename file
  • Rename folder
  • Link /download

支持功能:

  • 使用共享密钥身份验证初始化连接
  • 列出目录和文件
  • 生成临时 SAS URL 进行文件访问
  • 创建目录
  • 移动和重命名文件/文件夹
  • 复制文件/文件夹
  • 删除文件/文件夹
  • 上传文件并支持进度跟踪

已知问题

  • 不能自动创建container,(alist 功能不影响)
  • 大文件重命名和移动操作效率很低 (blob 没有rename能力,所以是复制删除实现,datalake gen2 版的存储和API支持rename,但是认证似乎比较复杂)
  • 文件夹是虚拟目录实现

PS:
Golang 没怎么写过,代码大部分是Copilot写的,请review详细点

实现 Azure Blob Storage 驱动,支持以下功能:
- 使用共享密钥身份验证初始化连接
- 列出目录和文件
- 生成临时 SAS URL 进行文件访问
- 创建目录
- 移动和重命名文件/文件夹
- 复制文件/文件夹
- 删除文件/文件夹
- 上传文件并支持进度跟踪

此驱动允许用户通过 AList 平台无缝访问和管理 Azure Blob Storage 中的数据。
@NewFuture NewFuture marked this pull request as ready for review March 31, 2025 11:23
@NewFuture NewFuture changed the title Add Azure Blob storage driver feat(driver): add Azure Blob Storage driver Mar 31, 2025
@NewFuture
Copy link
Contributor Author

to resolve #7816

@xhofe xhofe requested a review from Copilot April 2, 2025 01:53
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 adds a new Azure Blob Storage driver to integrate with Azure's storage services for various file operations. Key changes include:

  • Implementation of core driver methods (List, Put, Remove, Move, Rename, Copy) with Azure Blob SDK.
  • Utility functions for handling blob listing, deletion, and directory marker management.
  • Updates to driver configuration, registration, and documentation in the README to support Azure Blob Storage.

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
drivers/azure_blob/util.go Contains utility functions for blob listing, deletion, and directory operations.
drivers/azure_blob/types.go Adds a progress tracker to monitor file upload progress.
drivers/azure_blob/meta.go Provides metadata configuration and driver registration.
drivers/azure_blob/driver.go Implements main driver functions (List, Put, Move, Rename, etc.) for Azure Blob Storage.
drivers/all.go Registers the new Azure Blob Storage driver.
README.md Updates documentation to include Azure Blob Storage support.
Files not reviewed (1)
  • go.mod: Language not supported
Comments suppressed due to low confidence (2)

drivers/azure_blob/driver.go:309

  • Using log.Fatalf here abruptly terminates the program; consider propagating the error instead of calling fatal to allow for graceful error handling.
log.Fatalf("failed to delete source directory [%s]: %v\n", srcPath, err)

drivers/azure_blob/driver.go:323

  • Using log.Fatalf for error handling in file deletion interrupts the normal flow of execution; it is recommended to return the error to let the caller handle it.
log.Fatalf("failed to delete source file [%s]: %v\n", srcPath, err)

NewFuture and others added 3 commits April 2, 2025 10:23
fix(azure): fix name check

Co-authored-by: Copilot <[email protected]>
doc(readme): fix the link

Co-authored-by: Copilot <[email protected]>
@NewFuture
Copy link
Contributor Author

updated

@xhofe xhofe merged commit 2e21df0 into AlistGo:main Apr 3, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants