@@ 1,24 1,11 @@
-# [asyncio-foundationdb](https://github.com/amirouche/asyncio-foundationdb/)
+# asyncio-foundationdb
-*early draft*
+**early draft**
asyncio drivers for foundationdb tested with CPython 3.9 and PyPy 3.7
[](https://unsplash.com/photos/lRoX0shwjUQ)
-## Table of Content
-
-<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
-- [Getting started](#getting-started)
-- [ChangeLog](#changelog)
- - [v0.10.x](#v010x)
-- [`import found`](#import-found)
-- [`from found import bstore`](#from-found-import-bstore)
-- [`from found import nstore`](#from-found-import-nstore)
-- [`from found import eavstore`](#from-found-import-eavstore)
-- [`from found import pstore`](#from-found-import-pstore)
-<!-- markdown-toc end -->
-
## Getting started
```
@@ 29,19 16,17 @@ pip install asyncio-foundationdb
import found
-async def get(tx, key):
- out = await found.get(tx, key)
-
-async def set(tx, key, value):
- return found.set(tx, key, value)
-
-
db = await found.open()
-out = await found.transactional(db, get, b'hello')
+out = await found.transactional(db, found.get, b'hello')
assert out is None
+async def set(tx, key, value):
+ # found.set is not a coroutine!
+ found.set(tx, key, value)
+
await found.transactional(db, set, b'hello', b'world')
-out = await found.transactional(db, get, b'hello')
+
+out = await found.transactional(db, found.get, b'hello')
assert out == b'world'
```
@@ 96,7 81,8 @@ with `key`, returns the object `None`.
### `found.set(tx, key, value)`
-Set `key` to `value`.
+Set `key` to `value`. `found.set` is not a coroutine, it does not need
+`await`.
In the database associated with `tx`, associate `key` with
`value`. Both `key` and `value` must be `bytes`.
@@ 129,8 115,8 @@ range of keys.
If `other=None`, then clear the association that might exists with
`key`. Otherwise, if `other` is provided, `found.clear` will remove
-any association between `key` and `other` but not the association with
-`other` if any (that is `other` is excluded from the range).
+all associations between `key` and `other` but not the association
+with `other` if any, that is `other` is excluded from the range.
### async `found.query(tx, key, other, *, limit=0, mode=STREAMING_MODE_ITERATOR)`