Skip to content

Commit

Permalink
Point to async example in konserve.
Browse files Browse the repository at this point in the history
  • Loading branch information
whilo committed Mar 13, 2023
1 parent ba0c8c9 commit f685435
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

A [S3](https://aws.amazon.com/s3) backend for [konserve](https://github.com/replikativ/konserve).


## Usage

Add to your dependencies:

[![Clojars Project](http://clojars.org/io.replikativ/konserve-s3/latest-version.svg)](http://clojars.org/io.replikativ/konserve-s3)

### Synchronous Execution
### Example

For asynchronous execution take a look at the [konserve example](https://github.com/replikativ/konserve#asynchronous-execution).


``` clojure
(require '[konserve-s3.core :refer [connect-s3-store]]
Expand Down Expand Up @@ -43,38 +45,6 @@ Add to your dependencies:

```

### Asynchronous Execution

``` clojure
(ns test-db
(require '[konserve-s3.core :refer [connect-store]]
'[clojure.core.async :refer [<!]]
'[konserve.core :as k])

(def s3-spec
{:region "us-west-1"
:bucket "konserve-demo"})

(def store (<! (connect-store s3-spec :opts {:sync? false})))

(<! (k/assoc-in store ["foo" :bar] {:foo "baz"}))
(<! (k/get-in store ["foo"]))
(<! (k/exists? store "foo"))

(<! (k/assoc-in store [:bar] 42))
(<! (k/update-in store [:bar] inc))
(<! (k/get-in store [:bar]))
(<! (k/dissoc store :bar))

(<! (k/append store :error-log {:type :horrible}))
(<! (k/log store :error-log))

(<! (k/bassoc store :binbar (byte-array (range 10)) {:sync? false}))
(<! (k/bget store :binbar (fn [{:keys [input-stream]}]
(map byte (slurp input-stream)))
{:sync? false}))
```

Note that you do not need full S3 rights if you manage the bucket outside, i.e.
create it before and delete it after usage form a privileged account. Connection
will otherwise create a bucket and it can be recursively deleted by
Expand Down

0 comments on commit f685435

Please sign in to comment.