<commit_before>(ns com.narkisr.fake-fs
  (:gen-class)
  (:import fuse.FuseMount org.apache.commons.logging.LogFactory))

(gen-class
  :name com.narkisr.fake
  :implements [fuse.Filesystem3]
  :prefix "filesystem-")



(defn -main []
  (FuseMount/mount
    (into-array ["/home/ronen/CodeProjects/couch-fuse/fake" "-f"])
    (new com.narkisr.fake)
    (LogFactory/getLog (class com.narkisr.fake))))


(comment
  public int getattr (String path, FuseGetattrSetter getattrSetter) throws FuseException ;<commit_msg>lookup & root impl<commit_after>(ns com.narkisr.fake-fs
  (:gen-class)
  (:import fuse.FuseMount org.apache.commons.logging.LogFactory))

(defn- with-type [type x]
  (with-meta x {:type type}))


(defstruct node :name :mode :xattrs)
(defstruct directory :node :files)
(defstruct file :node :content)
(defstruct link :node :link)

(def root
  (with-type :directory
    (struct directory (struct node "/" 0755 [:description "Root directory"])
      [(struct file (struct node "README" 0644 [:description "A Readme File" :mimetype "text/plain"]) (. "this is a nice readme contents" getBytes))])))



(defn lookup [path]
  (if (= path "/") root
    (let [f (java.io.File. path) parent (lookup (. f getParent))]
      (if ((type parent) :directory) (find (parent :files) (. f getName))))))

(gen-class
  :name com.narkisr.fake
  :implements [fuse.Filesystem3]
  :prefix "fs-")

(defn fs-getdir [this path dirFiller]
  (identity 0))


(defn -main []
  (FuseMount/mount
    (into-array ["/home/ronen/CodeProjects/couch-fuse/fake" "-f"])
    (new com.narkisr.fake)
    (LogFactory/getLog (class com.narkisr.fake))))


(comment
  public int getattr (String path, FuseGetattrSetter getattrSetter) throws FuseException ;
{'fraction_non_alphanumeric': 0.15474112856311809, 'fraction_numerical': 0.006399069226294357, 'mean_word_length': 4.103857566765579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2636957', 'n_tokens_mistral': 649, 'n_tokens_neox': 617, 'n_words': 156}