Created
September 26, 2015 16:52
-
-
Save bhagany/04f60177b40e792220fd 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 DatascriptS3Db [bucket key-name schema conn-ch conn] | |
component/Lifecycle | |
(start [this] | |
(let [conn-ch* (chan 1 (map (s3-obj->conn schema)))] | |
(pipe (u/get-obj-ch bucket key-name) conn-ch*) | |
(assoc this :conn-ch (go-loop | |
(if conn | |
conn | |
(<! conn-ch*)))))) | |
(stop [this] | |
(-> this | |
(dissoc :conn-ch)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment