umamaheswararao edited a comment on pull request #1215:
URL: https://github.com/apache/hadoop-ozone/pull/1215#issuecomment-660448738


   @smengcl yes, fs.trash.classname configuration is for all HCFS.
   If we wanted to have different impls for HCFSs, we may need to introduce new 
advanced config, that should be like 
   'fs.SCHEME.trash.classname'.
   
   The impl can be something like below:
     ```
   public static TrashPolicy getInstance(Configuration conf, FileSystem fs) {
       Class<? extends TrashPolicy> defaultTrashClass = conf.getClass(
           "fs.trash.classname", TrashPolicyDefault.class, TrashPolicy.class);
       Class<? extends TrashPolicy>  trashClass = conf.getClass(String.format(
           "fs.%s.trash.classname",
           fs.getScheme()), defaultTrashClass, TrashPolicy.class);
       TrashPolicy trash = ReflectionUtils.newInstance(trashClass, conf);
       trash.initialize(conf, fs); // initialize TrashPolicy
       return trash;
     }
   ```
   
   ```
   @Test
     public void testPluggableFileSystemSpecificTrash() throws IOException {
       Configuration conf = new Configuration();
       // Test plugged TrashPolicy
       conf.setClass("fs.file.trash.classname", TestTrashPolicy.class, 
TrashPolicy.class);
       Trash trash = new Trash(conf);
       
assertTrue(trash.getTrashPolicy().getClass().equals(TestTrashPolicy.class));
     }
   ```
   
   So, by no change in behavior. If some one wants to override the behaviors 
for a specific fs, provide your TrashClass name in config. Ex: if you want to 
provide a trashPolicy for ofs separately, then configure like:
   fs.ofs.trash.classname = OfsTrashPolicyDefault.class.getName();
   Otherwise same TrashPolicyDefault.class will be used.
   
     


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to