Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns coresystem.system.database
- (:require [clojure.tools.logging :refer [info]]
- [com.stuartsierra.component :as component]
- [coresystem.seed :as seeder]
- [clojurewerkz.titanium.graph :as tg]))
- (defrecord Database [graphConfig]
- component/Lifecycle
- (start [component]
- (info "Starting titan")
- (let [graph (tg/open graphConfig)]
- (if (= (graphConfig "storage.backend") "inmemory")
- (do
- (info "Inmemory implementation is executed. Populating SEED data.")
- (seeder/run graph)
- (def debuggraph graph)))
- (assoc component :graph graph)))
- (stop [component]
- (info "Stopping titan")
- (when-let [titan (:jetty component)]
- (when-not (.isStopped titan)
- (.stop titan)))
- component))
- (defn database [graphConfig]
- (map->Database {:graphConfig graphConfig}))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement