· 7 years ago · Mar 04, 2018, 10:22 AM
1(ns migratool.core
2 (:gen-class)
3 (:require [clojure.string :as string]
4 [amazonica.core :refer :all]
5 [amazonica.aws.s3 :as s3]
6 [com.climate.claypoole :as cp]))
7
8(def access-key "")
9(def secret-key "")
10(def bucket "")
11(def creds {:access-key access-key :secret-key secret-key :endpoint ""})
12
13(defn verify-object [object-name]
14 (let [exists (s3/does-object-exist creds bucket object-name)]
15 (cond (false? exists) (do (println object-name) "")
16 :else "")))
17
18(defn check-files [files region]
19 (cp/with-shutdown! [net-pool (cp/threadpool 40)]
20 (def rsps (cp/upmap net-pool verify-object files))
21 (doall rsps)))
22
23(defn -main
24 "I don't do a whole lot ... yet."
25 [& args]
26 (let [contents (string/split-lines (slurp ""))]
27 (do
28 (check-files contents "ap-northeast-1"))))