Skip to content

Commit

Permalink
Merge pull request #35 from codenotary/session_auth
Browse files Browse the repository at this point in the history
Session auth
  • Loading branch information
jeroiraz committed Nov 29, 2022
2 parents 912032b + 90bac3c commit 170d0f0
Show file tree
Hide file tree
Showing 29 changed files with 794 additions and 807 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -134,7 +134,7 @@ task immudbStart {
pb.command("/bin/bash", "immudb/start.sh")
Process proc = pb.start()

proc.waitFor(10, TimeUnit.SECONDS)
proc.waitFor(5, TimeUnit.SECONDS)

if (proc.isAlive()) {
println "immudb has been started."
Expand Down
4 changes: 2 additions & 2 deletions immudb/start.sh
Expand Up @@ -13,10 +13,10 @@ then
echo "Downloading immudb..."

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
URL=https://github.com/vchain-us/immudb/releases/download/v1.3.0/immudb-v1.3.0-linux-amd64
URL=https://github.com/vchain-us/immudb/releases/download/v1.4.0/immudb-v1.4.0-linux-amd64
wget -O immudb $URL
elif [[ "$OSTYPE" == "darwin"* ]]; then
URL=https://github.com/vchain-us/immudb/releases/download/v1.3.0/immudb-v1.3.0-darwin-amd64
URL=https://github.com/vchain-us/immudb/releases/download/v1.4.0/immudb-v1.4.0-darwin-amd64
curl -o immudb -L $URL
fi

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/io/codenotary/immudb4j/FileImmuStateHolder.java
Expand Up @@ -59,21 +59,21 @@ private FileImmuStateHolder(Builder builder) throws IOException, IllegalStateExc
}

@Override
public synchronized ImmuState getState(String serverUuid, String database) {
return stateHolder.getState(serverUuid, database);
public synchronized ImmuState getState(String database) {
return stateHolder.getState(database);
}

@Override
public synchronized void setState(String serverUuid, ImmuState state) throws IllegalStateException {
public synchronized void setState(ImmuState state) throws IllegalStateException {

ImmuState currentState = stateHolder.getState(serverUuid, state.getDatabase());
ImmuState currentState = stateHolder.getState(state.getDatabase());
if (currentState != null && currentState.getTxId() >= state.getTxId()) {
return;
}

stateHolder.setState(serverUuid, state);
stateHolder.setState(state);

Path newStateFile = statesFolder.resolve("state_" + serverUuid + "_" + state.getDatabase() + "_" + System.nanoTime());
Path newStateFile = statesFolder.resolve("state_" + state.getDatabase() + "_" + System.nanoTime());

if (Files.exists(newStateFile)) {
throw new RuntimeException("Failed attempting to create a new state file. Please retry.");
Expand Down

0 comments on commit 170d0f0

Please sign in to comment.