-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from takipi/develop
Releasing 1.6.0
- Loading branch information
Showing
29 changed files
with
582 additions
and
174 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
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
8 changes: 8 additions & 0 deletions
8
src/main/java/com/takipi/oss/storage/data/simple/SimpleFetchRequest.java
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.takipi.oss.storage.data.simple; | ||
|
||
import com.takipi.oss.storage.data.EncodingType; | ||
|
||
public class SimpleFetchRequest { | ||
public EncodingType encodingType; | ||
public String path; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/takipi/oss/storage/data/simple/SimpleFetchResponse.java
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.takipi.oss.storage.data.simple; | ||
|
||
public class SimpleFetchResponse { | ||
String data; | ||
|
||
public SimpleFetchResponse(String data) { | ||
this.data = data; | ||
} | ||
|
||
public String getData() { | ||
return data; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/takipi/oss/storage/data/simple/SimpleSearchRequest.java
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.takipi.oss.storage.data.simple; | ||
|
||
import com.takipi.oss.storage.data.EncodingType; | ||
|
||
public class SimpleSearchRequest { | ||
public EncodingType encodingType; | ||
public String name; | ||
public String baseSearchPath; | ||
public boolean preventDuplicates; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/takipi/oss/storage/data/simple/SimpleSearchResponse.java
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.takipi.oss.storage.data.simple; | ||
|
||
public class SimpleSearchResponse { | ||
String data; | ||
String path; | ||
|
||
public SimpleSearchResponse(String data, String path) { | ||
this.data = data; | ||
this.path = path; | ||
} | ||
|
||
public String getData() { | ||
return data; | ||
} | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/takipi/oss/storage/fs/api/FilesystemHealth.java
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.takipi.oss.storage.fs.api; | ||
|
||
public interface FilesystemHealth { | ||
/** | ||
* Checks if the filesystem is healthy. This will be called during health | ||
* check | ||
* | ||
* @return true iff the filesystem is healthy | ||
*/ | ||
boolean healthy(); | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/takipi/oss/storage/fs/folder/FolderFilesystemHealth.java
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.takipi.oss.storage.fs.folder; | ||
|
||
import java.io.File; | ||
|
||
import com.takipi.oss.storage.fs.api.FilesystemHealth; | ||
|
||
public class FolderFilesystemHealth implements FilesystemHealth { | ||
protected final File root; | ||
private final double maxUsedStoragePercentage; | ||
|
||
public FolderFilesystemHealth(String rootFolder, double maxUsedStoragePercentage) { | ||
this.root = new File(rootFolder); | ||
this.maxUsedStoragePercentage = maxUsedStoragePercentage; | ||
|
||
if (!healthy()) { | ||
throw new IllegalStateException("Problem with path " + rootFolder); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean healthy() { | ||
return (folderCheck() && maxUsedStorageCheck()); | ||
} | ||
|
||
private boolean folderCheck() { | ||
return ((this.root.canRead()) && (this.root.canWrite())); | ||
} | ||
|
||
private boolean maxUsedStorageCheck() { | ||
return ((maxUsedStoragePercentage >= 0) && (maxUsedStoragePercentage < 1) && ((this.root.getUsableSpace() / this.root | ||
.getTotalSpace()) <= maxUsedStoragePercentage)); | ||
} | ||
} |
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
Oops, something went wrong.