I have to HDFS folder size which is having sub directories from Clojure. How to use getContentSummary and getSpaceConsumed in Clojure. I know how to do this in Java.
FileSystem fs = FileSystem.get(config);
Path current = new Path(path);
double size= fs.getContentSummary(current).getSpaceConsumed();
Configuration has been set already and path is passed into this function. So size now has has the size of the directory mentioned as path. This is in Java. I want to know how to do this in Clojure.
Thanks.
you "just" need to follow the java interop guide:
(let [fs (FileSystem/get config)
current (Path. path)
size (.getSpaceConsumed (.getContentSummary fs current))]
(println size))
Or using the "->" macro, to make it read more like Java:
(let [fs (FileSystem/get config)
current (Path. path)
size (-> fs (.getContentSummary current) .getSpacedConsumed)]
(println size))