Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reugn/aerospike-client-kotlin
Aerospike Client for Kotlin
https://github.com/reugn/aerospike-client-kotlin
aerospike aerospike-client coroutine-library kotlin kotlin-library
Last synced: about 2 months ago
JSON representation
Aerospike Client for Kotlin
- Host: GitHub
- URL: https://github.com/reugn/aerospike-client-kotlin
- Owner: reugn
- License: apache-2.0
- Created: 2021-11-01T10:49:54.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-25T16:59:33.000Z (9 months ago)
- Last Synced: 2024-04-18T11:23:21.095Z (9 months ago)
- Topics: aerospike, aerospike-client, coroutine-library, kotlin, kotlin-library
- Language: Kotlin
- Homepage:
- Size: 154 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aerospike-client-kotlin
[![Build](https://github.com/reugn/aerospike-client-kotlin/actions/workflows/build.yml/badge.svg)](https://github.com/reugn/aerospike-client-kotlin/actions/workflows/build.yml)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.reugn/aerospike-client-kotlin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.reugn/aerospike-client-kotlin/)Aerospike Client for Kotlin wraps the Java client callback-based asynchronous methods and provides an idiomatic Kotlin API using coroutines and `Flow`.
The `AerospikeAsyncClient` takes the Java `AerospikeClient` as a constructor parameter and exposes it via the `asJava()` method.
Make sure to set the [ClientPolicy.eventLoops](https://docs.aerospike.com/docs/client/java/usage/async/eventloop.html) when creating the Java client.## Getting started
### Add as a dependency
```kotlin
dependencies {
implementation("io.github.reugn:aerospike-client-kotlin:")
}
```### Build from source
```sh
./gradlew build
```## Examples
```kotlin
@Test
fun `Perform operations on a key`(): Unit = runBlocking {
val record = asyncClient.operate(
null, keys[0],
Operation.put(Bin(intBin, 100)),
Operation.get()
)
assertEquals(100, record?.getInt(intBin))
}@Test
fun `Query all`(): Unit = runBlocking {
val queryStatement = QueryStatement(namespace, setName = set)
val flow = asyncClient.query(null, queryStatement)
val recordsNumber = flow.toList().size
assertEquals(keysSize, recordsNumber)
}
```## License
Licensed under the [Apache 2.0 License](./LICENSE).