[#174] Add kludge additional search #180

Merged
alexvanin merged 1 commit from r.loginov/frostfs-http-gw:feature/174-add_kludge_additional_search into master 2024-12-16 10:43:34 +00:00
Member

close #174

Example scenario:

$ frostfs-cli object put --cid Fg7jG5YBzw2UAKPAjW7TNdtafJ8yCJKihgHoyvwEs5BH --file ./cat.txt -r localhost:8080 --wallet ./s3-gw/user-wallet.json
  OID: A3iPFsYWvj6qqk3yZaAKyZEPEvqzYfURLYkd8LaE6wjK
  CID: Fg7jG5YBzw2UAKPAjW7TNdtafJ8yCJKihgHoyvwEs5BH
  
$ frostfs-cli object head --cid Fg7jG5YBzw2UAKPAjW7TNdtafJ8yCJKihgHoyvwEs5BH --oid A3iPFsYWvj6qqk3yZaAKyZEPEvqzYfURLYkd8LaE6wjK -r localhost:8080 --wallet ./s3-gw/user-wallet.json
 ...
Attributes:
  FileName=cat.txt
  Timestamp=1733985614 (2024-12-12 09:40:14 +0300 MSK)
 ...

$  curl -H "Authorization: Bearer <token>" http://localhost:8881/get_by_attribute/Fg7jG5YBzw2UAKPAjW7TNdtafJ8yCJKihgHoyvwEs5BH/FilePath/cat.txt
this is cat.txt file
close #174 Example scenario: ``` $ frostfs-cli object put --cid Fg7jG5YBzw2UAKPAjW7TNdtafJ8yCJKihgHoyvwEs5BH --file ./cat.txt -r localhost:8080 --wallet ./s3-gw/user-wallet.json OID: A3iPFsYWvj6qqk3yZaAKyZEPEvqzYfURLYkd8LaE6wjK CID: Fg7jG5YBzw2UAKPAjW7TNdtafJ8yCJKihgHoyvwEs5BH $ frostfs-cli object head --cid Fg7jG5YBzw2UAKPAjW7TNdtafJ8yCJKihgHoyvwEs5BH --oid A3iPFsYWvj6qqk3yZaAKyZEPEvqzYfURLYkd8LaE6wjK -r localhost:8080 --wallet ./s3-gw/user-wallet.json ... Attributes: FileName=cat.txt Timestamp=1733985614 (2024-12-12 09:40:14 +0300 MSK) ... $ curl -H "Authorization: Bearer <token>" http://localhost:8881/get_by_attribute/Fg7jG5YBzw2UAKPAjW7TNdtafJ8yCJKihgHoyvwEs5BH/FilePath/cat.txt this is cat.txt file ```
r.loginov self-assigned this 2024-12-12 06:51:34 +00:00
r.loginov added 1 commit 2024-12-12 06:51:34 +00:00
[#174] Add kludge additional search
All checks were successful
/ DCO (pull_request) Successful in 3m34s
/ Vulncheck (pull_request) Successful in 3m45s
/ Builds (pull_request) Successful in 2m8s
/ Lint (pull_request) Successful in 2m36s
/ Tests (pull_request) Successful in 1m58s
afce681f77
Advanced search is needed because some
software may keep FileName attribute
and ignore FilePath attribute during
file upload.

Signed-off-by: Roman Loginov <r.loginov@yadro.com>
r.loginov requested review from alexvanin 2024-12-12 06:51:34 +00:00
r.loginov requested review from dkirillov 2024-12-12 06:51:34 +00:00
r.loginov requested review from pogpp 2024-12-12 06:58:59 +00:00
r.loginov requested review from mbiryukova 2024-12-12 06:58:59 +00:00
r.loginov requested review from nzinkevich 2024-12-12 06:58:59 +00:00
Member

Nitpick: kludge.additional_search is a very nondescriptive name. May be we could come up with a better name? I suggest kludge.enable_filepath_fallback

Nitpick: `kludge.additional_search` is a very nondescriptive name. May be we could come up with a better name? I suggest `kludge.enable_filepath_fallback`
r.loginov force-pushed feature/174-add_kludge_additional_search from afce681f77 to badf5e4f09 2024-12-12 08:24:40 +00:00 Compare
Author
Member

Nitpick: kludge.additional_search is a very nondescriptive name. May be we could come up with a better name? I suggest kludge.enable_filepath_fallback

I like your suggestion. I'll wait a little longer, maybe there will be more suggestions for reinvention of this parameter.

> Nitpick: `kludge.additional_search` is a very nondescriptive name. May be we could come up with a better name? I suggest `kludge.enable_filepath_fallback` I like your suggestion. I'll wait a little longer, maybe there will be more suggestions for reinvention of this parameter.
Owner

I like enable_filepath_fallback.

I like `enable_filepath_fallback`.
alexvanin added this to the v0.32.0 milestone 2024-12-12 11:56:41 +00:00
Owner

We've decided to move this setting to feature config section instead of kludge. It may be considered as extra heuristics to process objects without FilePath attribute.

We've decided to move this setting to `feature` config section instead of `kludge`. It may be considered as extra heuristics to process objects without `FilePath` attribute.
r.loginov force-pushed feature/174-add_kludge_additional_search from badf5e4f09 to 6ad3e9dfcc 2024-12-13 03:42:11 +00:00 Compare
r.loginov force-pushed feature/174-add_kludge_additional_search from 6ad3e9dfcc to 209a2ee41c 2024-12-13 04:02:50 +00:00 Compare
alexvanin approved these changes 2024-12-13 12:15:58 +00:00
Dismissed
dkirillov reviewed 2024-12-13 12:40:28 +00:00
@ -323,0 +343,4 @@
return false
}
return strings.HasPrefix(val, "/") && strings.Count(val, "/") == 1 || !strings.ContainsRune(val, '/')
Member

Why do we use strings.ContainsRune rather than just strings.Contains?

Why do we use `strings.ContainsRune` rather than just `strings.Contains`?
Author
Member

For some reason I thought it would be faster for single characters. However, I looked at the source code, there is almost no difference. And the benchmarks are the same. I'll change it.

For some reason I thought it would be faster for single characters. However, I looked at the source code, there is almost no difference. And the benchmarks are the same. I'll change it.
dkirillov marked this conversation as resolved
dkirillov approved these changes 2024-12-13 12:40:35 +00:00
Dismissed
dkirillov left a comment
Member

LGTM

LGTM
r.loginov force-pushed feature/174-add_kludge_additional_search from 209a2ee41c to ef2b75597c 2024-12-13 14:05:35 +00:00 Compare
r.loginov dismissed alexvanin's review 2024-12-13 14:05:35 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

r.loginov dismissed dkirillov's review 2024-12-13 14:05:35 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

alexvanin approved these changes 2024-12-13 14:09:49 +00:00
dkirillov approved these changes 2024-12-16 09:49:22 +00:00
alexvanin merged commit dc100f03a6 into master 2024-12-16 10:43:34 +00:00
alexvanin deleted branch feature/174-add_kludge_additional_search 2024-12-16 10:43:42 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-http-gw#180
No description provided.