Skip to content

Instantly share code, notes, and snippets.

@pjstadig
Created February 25, 2022 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjstadig/5139e0f5d9e757fe5148e398d99199c7 to your computer and use it in GitHub Desktop.
Save pjstadig/5139e0f5d9e757fe5148e398d99199c7 to your computer and use it in GitHub Desktop.
Protocol + client
(ns stadig.storage
(:refer-clojure :exclude [get])
(:require
[stadig.storage.protocol :as proto]))
(defn get
[conn bucket key]
(when-not bucket
(throw (ex-info "Expected bucket" {:type ::bucket-error})))
(proto/get conn bucket key))
(defn put
[conn bucket key value]
(when-not bucket
(throw (ex-info "Expected bucket" {:type ::bucket-error})))
(proto/put conn bucket key value))
(defn delete
[conn bucket key]
(when-not bucket
(throw (ex-info "Expected bucket" {:type ::bucket-error})))
(proto/delete conn bucket key))
(defn close
[conn]
(proto/close conn))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment