Skip to content

feat(s3): implement Getter interface#1790

Merged
j2rong4cn merged 3 commits intoOpenListTeam:mainfrom
ZRHann:feat/s3_get
Apr 29, 2026
Merged

feat(s3): implement Getter interface#1790
j2rong4cn merged 3 commits intoOpenListTeam:mainfrom
ZRHann:feat/s3_get

Conversation

@ZRHann
Copy link
Copy Markdown
Contributor

@ZRHann ZRHann commented Dec 11, 2025

Description / 描述

The S3 driver has been updated to implement the Getter interface. This addition introduces the Get method, which allows the retrieval of both files and directories from S3. The method works by first attempting to fetch the object as a file using HeadObject. If the object is not found (HTTP 404), it checks if the path corresponds to a directory by listing objects with the given prefix. The Get method handles two different object listing strategies, “v1” and “v2”, based on the configuration of the ListObjectVersion.

Motivation and Context / 背景

  • Improve performance for directly accessing multi-level directories.
  • Some S3 implementations do not allow listing objects without a prefix at the first level (i.e., for paths like bucket://), which can cause issues with the original List method. This can prevent access to paths like bucket://xxx/xxx (althrough with prefix). By using Get, which directly retrieves objects based on the path, this problem can be avoided.

How Has This Been Tested? / 测试

I added logging inside the newly implemented Get method, then created an S3 storage instance to verify that:

  • the Get method was indeed invoked, and
  • it returned the correct results for both files and multi-level directories.

This confirmed that the new logic behaves as expected.

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).
    我已相应更新了相关仓库(若适用)。

jyxjjj
jyxjjj previously approved these changes Dec 15, 2025
Comment thread drivers/s3/driver.go
Comment thread drivers/s3/driver.go Outdated
Comment thread drivers/s3/driver.go Outdated
@Suyunmeng Suyunmeng force-pushed the main branch 4 times, most recently from a31fd53 to 7bea29c Compare April 2, 2026 17:27
@ZRHann ZRHann requested a review from j2rong4cn April 29, 2026 04:39
@j2rong4cn j2rong4cn merged commit 9033b55 into OpenListTeam:main Apr 29, 2026
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.

3 participants