duongkame opened a new pull request, #3912:
URL: https://github.com/apache/ozone/pull/3912

   ## What changes were proposed in this pull request?
   
   ### Problem
   The target of this task is to deprecate the `LookupFile` interface and use 
`GetKeyInfo` for the OFS use case.
   
   The gap between OFS and object storage use cases (like S3) is that due to a 
file system nature, OFS has to answer the file read requests from its client. A 
file read input is a file path and OFS needs to be able to decide if the given 
path is a valid file. To be specific, if the given path is not a file (but a 
directory), OFS should return an error. Reading empty files is a valid use case.
   
   ```
   // throws IOException if the given path is not a file.
   FileSystem.open(path)
   ```
   
   The `lookupKey` API returns the same content for an empty file and 
directory. 
   
   Today, this is solved in Ozone by the separated `lookupFile` API, detecting 
if the given key is a directory and throwing an error on server-side.
   ```
   throw new OMException(ResultCodes.NOT_A_FILE);
   ```
   
   `GetKeyInfo` replaces `lookupKey` and inherits the same limit. 
   
   ### Solution
   To make `GetKeyInfo` available for OFS, we can simply add to its response a 
field indicating if the key represents a directory or a file so that OFS client 
code can make the assertion.
   
   
   
   https://issues.apaceorg/jira/browse/HDDS-7419
   
   ## How was this patch tested?
   
   OFS integration test.


-- 
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]

Reply via email to