Skip to content

change: cache: take a directory as given, without stripping trailing / - #6

Merged
drmingdrmer merged 1 commit into
databendlabs:mainfrom
drmingdrmer:dir-as-given
Nov 18, 2026
Merged

drmingdrmer merged 1 commit into
databendlabs:mainfrom
drmingdrmer:dir-as-given

Conversation

@drmingdrmer

Copy link
Copy Markdown
Member

Changelog

change: cache: take a directory as given, without stripping trailing /

Summary

Cache::new(source, dir, name) and Cache::try_list_dir(dir) take a
directory and use it as given: the cache holds, and lists, the keys
under {dir}/. They no longer strip trailing /, so foo/ is the
empty-named directory inside foo, whose keys are foo//.... The
parameters are renamed from prefix to dir.

Details

Stripping every trailing / made the empty-named directory impossible
to name: try_list_dir("foo/") listed foo/..., and so did foo//.

Upgrade tip:

A caller that passes a directory with a trailing / and means the
directory without it, such as __fd_users/<tenant>/, must drop the
/. Otherwise it names the empty-named directory inside, and the
cache holds nothing of what it meant.

Fixes: #5


# Summary

`Cache::new(source, dir, name)` and `Cache::try_list_dir(dir)` take a
directory and use it as given: the cache holds, and lists, the keys
under `{dir}/`. They no longer strip trailing `/`, so `foo/` is the
empty-named directory inside `foo`, whose keys are `foo//...`. The
parameters are renamed from `prefix` to `dir`.

# Details

Stripping every trailing `/` made the empty-named directory impossible
to name: `try_list_dir("foo/")` listed `foo/...`, and so did `foo//`.

Upgrade tip:

A caller that passes a directory with a trailing `/` and means the
directory without it, such as `__fd_users/<tenant>/`, must drop the
`/`. Otherwise it names the empty-named directory inside, and the
cache holds nothing of what it meant.

Fixes: databendlabs#5

@xp-trumpet xp-trumpet left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@xp-trumpet reviewed 4 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on drmingdrmer).

@drmingdrmer
drmingdrmer merged commit 1ac1ca9 into databendlabs:main Nov 18, 2026
1 check passed
@drmingdrmer
drmingdrmer deleted the dir-as-given branch November 18, 2026 09:23
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.

Cache: take a directory as given, without stripping trailing /

2 participants