Created
November 7, 2015 11:51
-
-
Save xeqi/3aa6ca3819fab87a8af5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defrecord JimFSFactory [] | |
component/Lifecycle | |
(start [t] (Jimfs/newFileSystem (Configuration/unix)))) | |
(extend-protocol component/Lifecycle | |
Jimfs | |
(stop [t] (.close t))) | |
(defrecord PathFactory [fs] | |
component/Lifecycle | |
(start [t] | |
(doto (.getPath fs "some-file" (make-array String 0)) | |
(Files/createFile (make-array FileAttribute 0))))) | |
(-> (component/system-map | |
:fs (->JimFSFactory) | |
:path (map->PathFactory {})) | |
(component/system-using | |
{:path [:fs]}) | |
(component/start) | |
(doto (-> :path | |
(Files/exists (make-array LinkOption 0)) | |
prn)) | |
(component/stop)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment