https://github.com/amal/tkvs-kt-playground
Kotlin playground based on idea of "transactional key-value storage"
https://github.com/amal/tkvs-kt-playground
cli key-value key-value-store kotlin kotlin-cli
Last synced: over 1 year ago
JSON representation
Kotlin playground based on idea of "transactional key-value storage"
- Host: GitHub
- URL: https://github.com/amal/tkvs-kt-playground
- Owner: amal
- Created: 2024-01-26T21:30:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-31T20:28:23.000Z (over 2 years ago)
- Last Synced: 2025-01-23T12:46:31.835Z (over 1 year ago)
- Topics: cli, key-value, key-value-store, kotlin, kotlin-cli
- Language: Kotlin
- Homepage:
- Size: 1.66 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Roadmap: ROADMAP.md
Awesome Lists containing this project
README
**Simple in-memory transactional key-value store.**
* Supports `get`, `set`, `delete`, `count`, `begin`, `rollback`, `commit` operations.
* Supports nested transactions.
* Commit/rollback operations apply changes from the last transaction.
* Parallel/concurrent transactions are not supported.
* Not thread-safe!
Has 2 implementations:
1. [TkvsSingleMap.kt](src/main/kotlin/TkvsSingleMap.kt)
Implementation with single map, change logs, and value counters cache for *O(1)* computational complexity of count operation.
2. [TkvsStackOfMaps.kt](src/main/kotlin/TkvsStackOfMaps.kt)
Implementation based on stack of maps.
Unit tests: [TransactionalKeyValueStoreTestBase.kt](src/test/kotlin/TransactionalKeyValueStoreTestBase.kt)
A built jar is available in [bin/tkvs.jar](../../raw/main/bin/tkvs.jar).
Run it with `java -jar bin/tkvs.jar` for an interactive console (uses "single map" implementation).
In the console, type `h` or `help` to see available commands.