-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sharding, search, sorting, soft removal
- Loading branch information
1 parent
7324c68
commit d93f307
Showing
93 changed files
with
2,080 additions
and
3,873 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
name: test | ||
|
||
on: [ push ] | ||
on: push | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2.3.4 | ||
- uses: actions/checkout@v4.1.1 | ||
with: | ||
clean: false | ||
fetch-depth: 0 # with tags | ||
submodules: 'recursive' | ||
- uses: actions/setup-java@v1.4.3 | ||
- uses: actions/setup-java@v4.1.0 | ||
with: | ||
java-version: 11 | ||
- env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: sbt +compile +test | ||
java-version: 21 | ||
distribution: 'zulu' | ||
- run: sbt test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
.DS_Store | ||
target/ | ||
/tmp | ||
/.bsp/ | ||
.bloop | ||
.metals | ||
.vscode | ||
project/project | ||
project/metals.sbt | ||
/data/example-*/ | ||
/data/test-*/ | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[submodule "proto"] | ||
path = deps/proto | ||
url = https://github.com/zero-deps/proto | ||
url = git@github.com:zero-deps/proto.git | ||
branch = main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
-J-XX:MaxMetaspaceSize=512m | ||
-J-XX:MaxMetaspaceSize=1g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,32 @@ | ||
# Abstract scala type database | ||
# Scala Abstract Type Database | ||
|
||
![ci](https://github.com/zero-deps/kvs/workflows/ci/badge.svg) | ||
![Production Ready](https://img.shields.io/badge/Project%20Stage-Production%20Ready%20(main)-brightgreen.svg) | ||
![Development](https://img.shields.io/badge/Project%20Stage-Development%20(next)-yellowgreen.svg) | ||
|
||
Abstract Scala storage framework with high-level API for handling linked lists of polymorphic data (feeds). | ||
[![Documentation](https://img.shields.io/badge/documentation-pdf-yellow)](docs/kvs.pdf) | ||
[![Paper](https://img.shields.io/badge/paper-pdf-lightgrey)](https://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf) | ||
|
||
KVS is highly available distributed (AP) strong eventual consistent (SEC) and sequentially consistent (via cluster sharding) storage. It is used for data from sport and games events. In some configurations used as distributed network file system. Also can be a generic storage for application. | ||
This open-source project presents an abstract storage framework in Scala, offering a high-level API tailored for managing linked lists of polymorphic data, referred to as 'feeds.' The system, known as KVS (Key-Value Storage), boasts attributes such as high availability, distributed architecture (AP), strong eventual consistency (SEC), and sequential consistency achieved through cluster sharding. Its primary application involves handling data from sports and gaming events, but it can also serve as a distributed network file system or a versatile general-purpose storage solution for various applications. | ||
|
||
Designed with various backends in mind and to work in pure JVM environment. Implementation based on top of KAI (implementation of Amazon DynamoDB in Erlang) port with modification to use akka-cluster infrastructure. | ||
The design philosophy behind KVS encompasses versatility, with support for multiple backend implementations and compatibility within a pure JVM environment. The implementation is grounded in the KAI framework (an Erlang-based Amazon DynamoDB implementation), adapted to utilize the pekko-cluster infrastructure. | ||
|
||
Currently main backend is RocksDB to support embedded setup alongside application. Feed API (add/entries/remove) is built on top of Key-Value API (put/get/delete). | ||
At its core, KVS relies on RocksDB as the primary backend, enabling seamless integration in embedded setups alongside applications. The central Feed API, facilitating operations like addition, entry retrieval, and removal, is constructed upon the foundation of the Key-Value API, which includes functions for putting, getting, and deleting data. | ||
|
||
## Usage | ||
|
||
Add project as a git module. | ||
Add project as a git submodule. | ||
|
||
## Backend | ||
## Components | ||
|
||
* Ring | ||
* RocksDB | ||
* Memory | ||
* FS | ||
* SQL | ||
* etc. | ||
* `feed`: Introduces the Feed over Ring concept | ||
* `search`: Offers Search over Ring functionality | ||
* `sort`: Implements a Sorted Set on Ring | ||
* `rng`: Establishes a Ring structure using Pekko Cluster | ||
* `sharding`: Addresses Sequential Consistency & Cluster Sharding aspects | ||
|
||
## Test | ||
## Test & Demo | ||
|
||
```bash | ||
sbt> test | ||
sbt test | ||
sbt run | ||
``` | ||
|
||
## Resources | ||
|
||
### Chain Replication | ||
|
||
[Chain Replication in Theory and in Practice](http://www.snookles.com/scott/publications/erlang2010-slf.pdf) | ||
|
||
[Chain Replication for Supporting High Throughput and Availability](http://www.cs.cornell.edu/home/rvr/papers/OSDI04.pdf) | ||
|
||
[High-throughput chain replication for read-mostly workload](https://www.cs.princeton.edu/courses/archive/fall15/cos518/papers/craq.pdf) | ||
|
||
[Leveraging Sharding in the Design of Scalable Replication Protocols](https://ymsir.com/papers/sharding-socc.pdf) | ||
|
||
[Byzantine Chain Replication](http://www.cs.cornell.edu/home/rvr/newpapers/opodis2012.pdf) | ||
|
||
### Consensus Algorithm | ||
|
||
[RAFT](https://raft.github.io/raft.pdf) | ||
[SWIM](https://www.cs.cornell.edu/projects/Quicksilver/public_pdfs/SWIM.pdf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,52 @@ | ||
val scalav = "3.2.2" | ||
val zio = "2.0.10" | ||
val akka = "2.6.20" | ||
val rocks = "7.10.2" | ||
val protoj = "3.22.2" | ||
val lucene = "8.11.2" | ||
val scalav = "3.3.3" | ||
val zio = "2.1.9" | ||
val pekko = "1.1.1" | ||
val rocks = "9.6.1" | ||
val protoj = "4.28.2" | ||
val lucene = "9.11.1" | ||
|
||
lazy val root = project.in(file(".") ).aggregate(kvs) | ||
lazy val `kvs-root` = project.in(file(".")).settings( | ||
scalaVersion := scalav | ||
, libraryDependencies ++= Seq( | ||
"dev.zio" %% "zio-test-sbt" % zio % Test | ||
, "org.apache.pekko" %% "pekko-cluster-sharding" % pekko | ||
) | ||
, scalacOptions ++= Seq( | ||
"-language:strictEquality" | ||
, "-Wunused:imports" | ||
, "-Xfatal-warnings" | ||
, "-Yexplicit-nulls" | ||
) | ||
, run / fork := true | ||
, run / connectInput := true | ||
).dependsOn(kvs).aggregate(kvs) | ||
|
||
lazy val kvs = project.in(file("kvs")).settings( | ||
scalaVersion := scalav | ||
, libraryDependencies ++= Seq( | ||
"com.typesafe.akka" % "akka-cluster-sharding_2.13" % akka | ||
, "com.typesafe.akka" % "akka-slf4j_2.13" % akka | ||
, "ch.qos.logback" % "logback-classic" % "1.4.5" | ||
, "com.github.jnr" % "jnr-ffi" % "2.2.2" | ||
, "org.apache.lucene" % "lucene-analyzers-common" % lucene | ||
, "dev.zio" %% "zio" % zio | ||
, "dev.zio" %% "zio-nio" % "2.0.0" | ||
"dev.zio" %% "zio-streams" % zio | ||
, "dev.zio" %% "zio-test-sbt" % zio % Test | ||
, "org.apache.lucene" % "lucene-analysis-common" % lucene | ||
, "org.apache.pekko" %% "pekko-cluster-sharding" % pekko | ||
, "org.rocksdb" % "rocksdbjni" % rocks | ||
, "org.scalatest" %% "scalatest" % "3.2.14" % Test | ||
, "com.typesafe.akka" % "akka-testkit_2.13" % akka % Test | ||
) | ||
, scalacOptions ++= scalacOptions3 | ||
, testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework") | ||
, Test / fork := true | ||
, scalacOptions ++= Seq( | ||
"-language:strictEquality" | ||
, "-Wunused:imports" | ||
, "-Xfatal-warnings" | ||
, "-Yexplicit-nulls" | ||
) | ||
).dependsOn(proto) | ||
|
||
lazy val proto = project.in(file("deps/proto/proto")).settings( | ||
scalaVersion := scalav | ||
, crossScalaVersions := scalav :: Nil | ||
, libraryDependencies += "com.google.protobuf" % "protobuf-java" % protoj | ||
).dependsOn(protoops) | ||
).dependsOn(`proto-syntax`) | ||
|
||
lazy val protoops = project.in(file("deps/proto/ops")).settings( | ||
lazy val `proto-syntax` = project.in(file("deps/proto/syntax")).settings( | ||
scalaVersion := scalav | ||
, crossScalaVersions := scalav :: Nil | ||
).dependsOn(protosyntax) | ||
|
||
lazy val protosyntax = project.in(file("deps/proto/syntax")).settings( | ||
scalaVersion := scalav | ||
, crossScalaVersions := scalav :: Nil | ||
) | ||
|
||
val scalacOptions3 = Seq( | ||
"-source:future", "-nowarn" | ||
, "-language:strictEquality" | ||
, "-language:postfixOps" | ||
, "-Yexplicit-nulls" | ||
, "-encoding", "UTF-8" | ||
) | ||
|
||
turbo := true | ||
useCoursier := true | ||
Global / onChangedBuildSource := ReloadOnSourceChanges |
Submodule proto
updated
56 files
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.