Skip to content

Commit

Permalink
Merge pull request #41 from codenotary/stream_apis
Browse files Browse the repository at this point in the history
Stream apis
  • Loading branch information
jeroiraz committed Nov 29, 2022
2 parents 170d0f0 + 373a575 commit d17d48d
Show file tree
Hide file tree
Showing 33 changed files with 1,197 additions and 310 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew clean build
- name: Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
Expand Down
13 changes: 5 additions & 8 deletions build.gradle
Expand Up @@ -133,14 +133,7 @@ task immudbStart {
pb = new ProcessBuilder()
pb.command("/bin/bash", "immudb/start.sh")
Process proc = pb.start()

proc.waitFor(5, TimeUnit.SECONDS)

if (proc.isAlive()) {
println "immudb has been started."
} else {
throw new GradleException("Process exit bad: " + proc.exitValue())
}
proc.waitFor(15, TimeUnit.SECONDS)
}

task immudbStop(type: Exec) {
Expand All @@ -167,6 +160,10 @@ test {
}
// Run the unit tests sequentially.
maxParallelForks = 1

testLogging {
events "FAILED"
}
}

test.dependsOn immudbStart
Expand Down
3 changes: 1 addition & 2 deletions immudb/clean.sh
Expand Up @@ -11,7 +11,6 @@ then
fi

rm -rf data
rm -rf states

echo "immudb's data and immudb4j's states folders were removed."
echo "immudb's data folder was removed."

13 changes: 13 additions & 0 deletions src/main/java/io/codenotary/immudb4j/Entry.java
Expand Up @@ -28,8 +28,15 @@ public class Entry {

private Reference referencedBy;

private long revision;

private Entry() {}

public Entry(byte[] key, byte[] value) {
this.key = key;
this.value = value;
}

public static Entry valueOf(ImmudbProto.Entry e) {
final Entry entry = new Entry();

Expand All @@ -45,6 +52,8 @@ public static Entry valueOf(ImmudbProto.Entry e) {
entry.referencedBy = Reference.valueOf(e.getReferencedBy());
}

entry.revision = e.getRevision();

return entry;
}

Expand All @@ -68,6 +77,10 @@ public Reference getReferenceBy() {
return referencedBy;
}

public long getRevision() {
return revision;
}

public byte[] getEncodedKey() {
if (referencedBy == null) {
return Utils.wrapWithPrefix(key, Consts.SET_KEY_PREFIX);
Expand Down

0 comments on commit d17d48d

Please sign in to comment.