Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session auth #35

Merged
merged 4 commits into from Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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