 (defn resource-already-persisted?
   "Returns a boolean indicating whether or not the given resource exists in the db"
   [hash]
+  {:pre [hash]}
   (sql/with-query-results result-set
     ["SELECT EXISTS(SELECT 1 FROM resources WHERE hash=?) as present" hash]
     (let [row (first result-set)]

(defn persist-resource!
  "Given a certname and a single resource, persist that resource and its parameters"
  [certname {:keys [type title exported parameters tags] :as resource}]

  (let [hash       (compute-hash resource)
        persisted? (resource-already-persisted? hash)

(defn persist-certname!
  "Given a certname, persist it in the db"
  [certname api-version catalog-version]
  {:pre [certname api-version catalog-version]}
  (sql/insert-record :certnames {:name certname
                                 :api_version api-version
                                 :catalog_version catalog-version}))
