-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Refactor OnDemandBlockIndexInput to AbstractBlockIndexInput for extensibility #19613
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
Refactor OnDemandBlockIndexInput to AbstractBlockIndexInput for extensibility #19613
Conversation
…BlockIndexInput is an abstract class containing all the common operations for block index inputs. Also added static utility methods for common block operations. Signed-off-by: Abhinav Gupta <[email protected]>
|
❌ Gradle check result for 11e5a4f: null Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
server/src/main/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInput.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInput.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInput.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInput.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInput.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInput.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInput.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInput.java
Show resolved
Hide resolved
...er/src/main/java/org/opensearch/index/store/remote/file/OnDemandBlockSnapshotIndexInput.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInputTests.java
Show resolved
Hide resolved
|
❌ Gradle check result for 11e5a4f: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
…e utility methods. Corrected test cases. Signed-off-by: Abhinav Gupta <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19613 +/- ##
============================================
+ Coverage 73.06% 73.10% +0.03%
- Complexity 70630 70692 +62
============================================
Files 5723 5723
Lines 323513 323529 +16
Branches 46852 46853 +1
============================================
+ Hits 236384 236517 +133
+ Misses 68013 67982 -31
+ Partials 19116 19030 -86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
server/src/main/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInput.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInput.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/store/remote/file/AbstractBlockIndexInput.java
Show resolved
Hide resolved
…sibility (opensearch-project#19613) * Renaming OnDemandBlockIndexInput to AbstractBlockIndexInput. AbstractBlockIndexInput is an abstract class containing all the common operations for block index inputs. Also added static utility methods for common block operations. Signed-off-by: Abhinav Gupta <[email protected]> * Added missing documentation for the utility methods. Removed duplicate utility methods. Corrected test cases. Signed-off-by: Abhinav Gupta <[email protected]> --------- Signed-off-by: Abhinav Gupta <[email protected]>
…sibility (opensearch-project#19613) * Renaming OnDemandBlockIndexInput to AbstractBlockIndexInput. AbstractBlockIndexInput is an abstract class containing all the common operations for block index inputs. Also added static utility methods for common block operations. Signed-off-by: Abhinav Gupta <[email protected]> * Added missing documentation for the utility methods. Removed duplicate utility methods. Corrected test cases. Signed-off-by: Abhinav Gupta <[email protected]> --------- Signed-off-by: Abhinav Gupta <[email protected]>
…sibility (opensearch-project#19613) * Renaming OnDemandBlockIndexInput to AbstractBlockIndexInput. AbstractBlockIndexInput is an abstract class containing all the common operations for block index inputs. Also added static utility methods for common block operations. Signed-off-by: Abhinav Gupta <[email protected]> * Added missing documentation for the utility methods. Removed duplicate utility methods. Corrected test cases. Signed-off-by: Abhinav Gupta <[email protected]> --------- Signed-off-by: Abhinav Gupta <[email protected]>
Description
This pull request refactors the
OnDemandBlockIndexInputclass to create a more extensibleAbstractBlockIndexInputclass. The main changes are:Renaming and abstracting the class:
OnDemandBlockIndexInputclass has been renamed toAbstractBlockIndexInput.AbstractBlockIndexInputis now an abstract class that serves as a generic base class for block-based index inputs.AbstractBlockIndexInputto be used as a parent class for any block-based index input implementation, not just the "on-demand" use case.Introducing utility methods:
AbstractBlockIndexInputto handle common block-related operations, such as:getBlockSize: Calculates the block size based on the provided block size shift.getBlock: Calculates the block ID for a given file offset.getBlockOffset: Calculates the offset within a block for a given file offset.getBlockStart: Calculates the starting file offset of a given block.getNumberOfBlocks: Calculates the total number of blocks for a given file size.getActualBlockSize: Calculates the actual size of a given block.getAllBlockIdsForFile: Returns a list of all block IDs for a given file.isBlockFilename: Checks if a given file name follows the block file naming convention.getBlockFileName: Generates a block file name based on the original file name and block ID.getFileNameFromBlockFileName: Extracts the original file name from a block file name.Updating the
OnDemandBlockSnapshotIndexInputclass:OnDemandBlockSnapshotIndexInputclass, which was previously extendingOnDemandBlockIndexInput, has been updated to extend the newAbstractBlockIndexInputclass.OnDemandBlockSnapshotIndexInputto leverage the new utility methods provided byAbstractBlockIndexInput, simplifying its implementation.Documentation updates:
AbstractBlockIndexInputto explain their purpose and usage.OnDemandBlockSnapshotIndexInputclass have been updated to reflect the changes.The goal of these changes is to create a more extensible and reusable base class for handling block-based index inputs. By abstracting the common block-related functionality into the
AbstractBlockIndexInputclass, the changes pave the way for other block-based index input implementations to leverage this infrastructure, promoting code reuse and maintainability.Related Issues
Check List
[ ] API changes companion pull request created, if applicable.[ ] Public documentation issue/PR created, if applicable.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.