Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zio/zio-rocksdb
A ZIO-based interface to RocksDB.
https://github.com/zio/zio-rocksdb
rocksdb scala zio
Last synced: 2 months ago
JSON representation
A ZIO-based interface to RocksDB.
- Host: GitHub
- URL: https://github.com/zio/zio-rocksdb
- Owner: zio
- License: apache-2.0
- Created: 2019-12-28T13:42:55.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-06T15:34:47.000Z (about 1 year ago)
- Last Synced: 2024-08-03T01:18:34.871Z (5 months ago)
- Topics: rocksdb, scala, zio
- Language: Scala
- Homepage: https://zio.dev/zio-rocksdb
- Size: 103 KB
- Stars: 32
- Watchers: 11
- Forks: 16
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-zio - zio-rocksdb - based interface to RocksDB. (NoSQL)
README
[![Project stage][Stage]][Stage-Page]
[![Release Artifacts][Badge-SonatypeReleases]][Link-SonatypeReleases]# zio-rocksdb
A ZIO-based interface to RocksDB.
## Installation
Add the following dependencies to your `build.sbt` file:
```scala
libraryDependencies ++= Seq(
"dev.zio" %% "zio-rocksdb" % ""
)
```## Using RocksDB
Use the provided `RocksDB` wrapper:
```scala
import java.nio.charset.StandardCharsetsimport zio.rocksdb
import zio.rocksdb.{ RocksDB }val UTF_8 = StandardCharsets.UTF_8
val key = "key".getBytes(UTF_8)
val value = "value".getBytes(UTF_8)val database = RocksDB.live("/data/state")
val readWrite = RocksDB.put(key, value) *> RocksDB.get(key)
val result = readWrite.provideCustomLayer(database)
```## Using TransactionDB
`zio-rocksdb` provides transactional capabilities using RocksDB [Transaction API].```scala
import java.nio.charset.StandardCharsetsimport zio.rocksdb
import zio.rocksdb.{ TransactionDB, Transaction }val key0 = "key0".getBytes(UTF_8)
val key1 = "key1".getBytes(UTF_8)
val value0 = "value0".getBytes(UTF_8)
val value1 = "value1".getBytes(UTF_8)val database = TransactionDB.live("/data/state")
val write0 = Transaction.put(key0, value0)
val write1 = Transaction.put(key1, value1)
val writeTogether = TransactionDB.atomically {
write0 <&> write1
}
val result = readWrite.provideCustomLayer(database)
```[Transaction API]: https://github.com/facebook/rocksdb/wiki/Transactions#transactiondb
## Getting help
Join us on the [ZIO Discord server](https://discord.gg/2ccFBr4).
## Legal
Copyright 2019 Itamar Ravid and the zio-rocksdb contributors. All rights reserved.
[Link-SonatypeReleases]: https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-rocksdb_2.12/ "Sonatype Releases"
[Badge-SonatypeReleases]: https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-rocksdb_2.12.svg "Sonatype Releases"
[Stage]: https://img.shields.io/badge/Project%20Stage-Development-yellowgreen.svg
[Stage-Page]: https://github.com/zio/zio/wiki/Project-Stages