Skip to content

Commit

Permalink
0.19.7
Browse files Browse the repository at this point in the history
* Parallelize the corruption scanner.
* Optimize deletion of empty directory trees.
  • Loading branch information
a-hansen authored Apr 16, 2020
1 parent 2736cff commit 95814d5
Show file tree
Hide file tree
Showing 8 changed files with 279 additions and 162 deletions.
34 changes: 25 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
# Misc
.DS_Store

# Gradle
.gradle
build
**/.gradle
**/build

# Misc
**.bak
**.class
**.iml
**.old
**/.classpath
**/.DS_Store
**/.idea
**/.metadata
**/.project
**/.settings
**/eclipseBin
**/libJar
**/out
**/target
**/bin

# Project files
*.iml
.idea
/bin/
# Runtime files
**/.key
db
dslink.properties
nodes.json
nodes.json.bak
13 changes: 5 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,22 @@ apply plugin: 'java-library'
mainClassName = 'org.dsa.iot.etsdb.Main'
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '0.19.6'
version = '0.19.7'

repositories {
mavenLocal()
jcenter()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}

wrapper {
gradleVersion = '6.1'
gradleVersion = '6.2.2'
}

dependencies {
compileOnly 'com.google.code.findbugs:annotations:[3.0.1,)'
api 'org.iot-dsa:commons:0.23.1'
api 'org.iot-dsa:dslink:0.23.1'
api 'org.iot-dsa:historian:0.23.1'
api 'org.iot-dsa:commons:0.23.2'
api 'org.iot-dsa:dslink:0.23.2'
api 'org.iot-dsa:historian:0.23.2'
}

run {
Expand Down
5 changes: 2 additions & 3 deletions dslink.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "dslink-java-etsdb",
"version": "0.19.6",
"version": "0.19.7",
"description": "Historian DSLink implementation for ETSDB",
"license": "Apache",
"author": {
"name": "Samuel Grenier",
"email": "[email protected]"
"name": "Samuel Grenier"
},
"main": "bin/dslink-java-etsdb",
"repository": {
Expand Down
33 changes: 22 additions & 11 deletions src/main/java/org/etsdb/impl/ChecksumInputStream.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package org.etsdb.impl;

import java.io.*;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

class ChecksumInputStream extends InputStream implements ChecksumInput {

private final InputStream delegate;

private byte sum;
Expand All @@ -15,7 +21,7 @@ class ChecksumInputStream extends InputStream implements ChecksumInput {
ChecksumInputStream(File dataFile) {
if (dataFile.exists()) {
try {
this.delegate = new BufferedInputStream(new FileInputStream(dataFile));
this.delegate = new BufferedInputStream(new FileInputStream(dataFile), 32768);
} catch (FileNotFoundException e) {
// This should not happen because we just checked that the file exists.
throw new RuntimeException(e);
Expand All @@ -28,8 +34,9 @@ class ChecksumInputStream extends InputStream implements ChecksumInput {

@Override
public boolean checkSum() throws IOException {
if (eof)
if (eof) {
return false;
}

byte b = (byte) delegate.read();
position++;
Expand All @@ -40,13 +47,14 @@ public boolean checkSum() throws IOException {

@Override
public int read() throws IOException {
if (eof)
if (eof) {
return -1;
}

int i = delegate.read();
if (i == -1)
if (i == -1) {
eof = true;
else {
} else {
position++;
sum += (byte) i;
}
Expand All @@ -56,16 +64,18 @@ public int read() throws IOException {

@Override
public int read(byte[] b, int off, int len) throws IOException {
if (eof)
if (eof) {
return -1;
}

int count = delegate.read(b, off, len);
if (count == -1)
if (count == -1) {
eof = true;
else {
} else {
position += count;
for (int i = 0; i < count; i++)
for (int i = 0; i < count; i++) {
sum += b[i + off];
}
}
return count;
}
Expand Down Expand Up @@ -116,7 +126,8 @@ public long skip(long n) throws IOException {

@Override
public void close() throws IOException {
if (delegate != null)
if (delegate != null) {
delegate.close();
}
}
}
Loading

0 comments on commit 95814d5

Please sign in to comment.