Skip to content

Introduce Hns and Flat strategy and integrate with GcsFileSystem - #311

Open
suni72 wants to merge 23 commits into
GoogleCloudPlatform:mainfrom
suni72:dir-metadata-ops-2
Open

Introduce Hns and Flat strategy and integrate with GcsFileSystem#311
suni72 wants to merge 23 commits into
GoogleCloudPlatform:mainfrom
suni72:dir-metadata-ops-2

Conversation

@suni72

@suni72 suni72 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Type of Change

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • chore: Changes to the build process or auxiliary tools and libraries such as documentation generation

Description

What?

  • Introduces the NamespaceStrategy interface alongside FlatNamespaceStrategyImpl and HierarchicalNamespaceStrategyImpl implementations.
  • Update GcsFileSystemImpl to integrate NamespaceStrategy based on bucket HNS configuration and HNS API enable flag in core.
  • Added options in GcsFileSystemOptions to configure HNS API usage.

Why?

Dynamically routes folder commands based on the bucket's namespace configuration (flat vs. hierarchical).

Checklist

  • PR title follows Conventional Commits (e.g., feat(core): ...)
  • All files include the Apache License 2.0 header
  • Documentation has been updated to reflect changes

Generated/Assisted by Agent? [Yes/No]

@codecov

This comment was marked as outdated.

@gemini-code-assist

This comment was marked as outdated.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a bucket capabilities caching layer and namespace strategy resolution to support Hierarchical Namespace (HNS) routing and optimization. Key changes include adding BucketCapabilities, defining NamespaceStrategy with flat and hierarchical implementations, and integrating a Caffeine-backed cache with TTL in AnalyticsCacheManager. Feedback focuses on improving encapsulation and API design, specifically by removing testing-only methods from the public GcsFileSystem interface, making internal methods package-private, converting BucketCapabilities to an @AutoValue class, and simplifying a lambda expression to a method reference.

Comment thread client/src/main/java/com/google/cloud/gcs/analyticscore/client/GcsFileSystem.java Outdated
@suni72
suni72 force-pushed the dir-metadata-ops-2 branch 3 times, most recently from c507032 to c58a027 Compare June 24, 2026 10:55
@suni72
suni72 force-pushed the dir-metadata-ops-2 branch 10 times, most recently from 70c1223 to 98f664d Compare July 10, 2026 12:52
@suni72
suni72 marked this pull request as ready for review July 10, 2026 13:04
@suni72
suni72 requested a review from a team as a code owner July 10, 2026 13:04
@suni72
suni72 requested a review from dheerajsngh July 10, 2026 13:05
@suni72
suni72 marked this pull request as draft July 28, 2026 06:32
@suni72
suni72 marked this pull request as ready for review July 29, 2026 10:46
Comment thread CONFIGURATION.md Outdated
suni72 added 2 commits August 3, 2026 12:25
- rename HNS configuration key to hierarchical.namespace.enable
- Update test names for clarity
- Reverted unrelated changes in FakeGcsFileSystemImpl

Updated tests to use constants instead of hardcoded strings

@dheerajsngh dheerajsngh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added some comments. PTAL
Other things look good.

@dheerajsngh
dheerajsngh self-requested a review August 4, 2026 05:31
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