shameersss1 commented on PR #6884:
URL: https://github.com/apache/hadoop/pull/6884#issuecomment-2264686264
> @shameersss1 what do you think of @raphaelazzolini 's comment
I understand @raphaelazzolini 's concern of having many isCSEEnabled
conditions especially in the listing methods. If i understand it correctly the
ask is to introduce to handler interface pattern as follows
`interface ListingHandler {
Listing getListing(Path path, boolean includeSelf);
}
class CSEEnabledListingHandler implements ListingHandler {
@Override
public Listing getListing(Path path, boolean includeSelf) {
return includeSelf
? new Listing.AcceptAllButS3nDirsAndCSEInstructionFile()
: new
Listing.AcceptAllButSelfAndS3nDirsAndCSEInstructionFile(path);
}
}
class CSEDisabledListingHandler implements ListingHandler {
@Override
public Listing getListing(Path path, boolean includeSelf) {
return includeSelf
? new Listing.AcceptAllButS3nDirs()
: new Listing.AcceptAllButSelfAndS3nDirs(path);
}
}
@Retries.RetryTranslated
public RemoteIterator<S3ALocatedFileStatus> listFilesAndDirectoryMarkers(
final Path path,
final S3AFileStatus status,
final boolean includeSelf) throws IOException {
auditSpan.activate();
ListingHandler handler = isCSEEnabled ? new CSEEnabledListingHandler() :
new CSEDisabledListingHandler();
return innerListFiles(path, true, handler.getListing(path, includeSelf),
status);
}
`
I agree handler interface strategy will be more elegant. I will make the
required code changes. I see there are conflicting changes which requires
rebase and force push
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]