-
Notifications
You must be signed in to change notification settings - Fork 713
perf: optimize get_opts for object store #9363
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
Conversation
|
Failed to generate code suggestions for PR |
Greptile OverviewGreptile SummaryRefactored
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Caller
participant CacheFS
participant file_data
participant memory
participant disk
participant storage
Caller->>CacheFS: get_opts(account, location, options)
CacheFS->>file_data: get_opts(account, path, options, false)
alt Memory cache enabled
file_data->>memory: get_opts(file, options)
memory-->>file_data: GetResult (Stream payload)
file_data-->>CacheFS: Ok(GetResult)
else Disk cache enabled
file_data->>disk: get_opts(file, options)
disk-->>file_data: GetResult (File payload)
file_data-->>CacheFS: Ok(GetResult)
else Cache miss & remote=true
file_data->>storage: get_opts(account, file, options)
storage-->>file_data: GetResult
file_data-->>CacheFS: Ok(GetResult)
end
CacheFS-->>Caller: GetResult
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 1 comment
There was a problem hiding this 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 refactors the get_opts function in the cache layer to optimize performance for vortex search operations, targeting a 5x improvement. The changes centralize GetResult construction logic by moving it from storage.rs into the individual cache implementations (memory.rs and disk.rs), eliminating redundant code and improving maintainability.
Key Changes
- Refactored
file_data::get_optsto returnGetResultinstead ofBytes, with cache implementations now handlingGetOptionsdirectly including range requests and preconditions - Simplified
CacheFSmethods (get,get_opts,get_range) to delegateGetResultconstruction to cache implementations - Added new
get_optsfunctions inmemory.rsanddisk.rswith proper etag generation and range handling
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/infra/src/cache/storage.rs | Simplified cache facade by removing manual GetResult construction, now delegates to cache implementations; updated imports and etag format |
| src/infra/src/cache/file_data/mod.rs | Changed get_opts signature to return GetResult instead of Bytes; updated get function to call .bytes() on result |
| src/infra/src/cache/file_data/memory.rs | Added get_opts function that constructs GetResult with proper metadata, etag, range handling, and precondition checks |
| src/infra/src/cache/file_data/disk.rs | Added get_opts function with file-based payload; added helper functions last_modified and get_etag for consistent metadata generation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Refactor
get_optsfunction that improve5xfor vortex search.