Skip to content

Commit

Permalink
Use snapshot-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
klauswuestefeld committed Nov 7, 2024
1 parent a2344fc commit 6473193
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/prevayler_clj_aws/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,13 @@
unmarshal-fn))

(defn- read-snapshot [s3-cli s3-sdk-cli bucket snapshot-path]
(if (snapshot-exists? s3-cli bucket snapshot-path)
(let [v2-path (snapshot-v2-path snapshot-path)
snap1 (read-object s3-sdk-cli bucket snapshot-path unmarshal)]
(if (snapshot-exists? s3-cli bucket v2-path)
(let [snap2 (read-object s3-sdk-cli bucket v2-path unmarshal-from-in)]
(throw (RuntimeException. (str "Snapshot v1" (if (= snap1 snap2) "IS" "IS NOT") "equal to v2"))))
(throw (RuntimeException. (str v2-path "object not found in bucket."))))
snap1)
{:partkey 0}))
(let [v2-path (snapshot-v2-path snapshot-path)]
(if (snapshot-exists? s3-cli bucket v2-path)
(read-object s3-sdk-cli bucket v2-path unmarshal-from-in)
{:partkey 0})))

(defn- save-snapshot! [s3-cli s3-sdk-cli bucket snapshot-path snapshot]
(util/aws-invoke s3-cli {:op :PutObject
#_(util/aws-invoke s3-cli {:op :PutObject
:request {:Bucket bucket
:Key snapshot-path
:Body (marshal snapshot)}})
Expand Down

0 comments on commit 6473193

Please sign in to comment.