-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: throwing more proper exceptions
wrapping IO and thread related exceptions at index level using InternalOperationException
- Loading branch information
Showing
29 changed files
with
312 additions
and
223 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/main/java/com/github/sepgh/internal/exception/IndexExistsException.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,7 @@ | ||
package com.github.sepgh.internal.exception; | ||
|
||
public class IndexExistsException extends Exception { | ||
public IndexExistsException() { | ||
super("Index already exists!"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/github/sepgh/internal/exception/InternalOperationException.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.github.sepgh.internal.exception; | ||
|
||
public class InternalOperationException extends Exception { | ||
public InternalOperationException(Exception exception) { | ||
super("Operation failed", exception); | ||
} | ||
|
||
public InternalOperationException(String message, Exception exception) { | ||
super(message, exception); | ||
} | ||
} |
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
12 changes: 6 additions & 6 deletions
12
src/main/java/com/github/sepgh/internal/index/IndexManager.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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package com.github.sepgh.internal.index; | ||
|
||
import com.github.sepgh.internal.exception.IndexExistsException; | ||
import com.github.sepgh.internal.exception.InternalOperationException; | ||
import com.github.sepgh.internal.index.tree.node.AbstractTreeNode; | ||
import com.github.sepgh.internal.index.tree.node.data.ImmutableBinaryObjectWrapper; | ||
|
||
import java.io.IOException; | ||
import java.util.Optional; | ||
import java.util.concurrent.ExecutionException; | ||
|
||
public interface IndexManager<K extends Comparable<K>, V extends Comparable<V>> { | ||
AbstractTreeNode<K> addIndex(int table, K identifier, V value) throws ExecutionException, InterruptedException, IOException, ImmutableBinaryObjectWrapper.InvalidBinaryObjectWrapperValue; | ||
Optional<V> getIndex(int table, K identifier) throws ExecutionException, InterruptedException, IOException; | ||
boolean removeIndex(int table, K identifier) throws ExecutionException, InterruptedException, IOException; | ||
int size(int table) throws InterruptedException, ExecutionException, IOException; | ||
AbstractTreeNode<K> addIndex(int table, K identifier, V value) throws IndexExistsException, InternalOperationException, ImmutableBinaryObjectWrapper.InvalidBinaryObjectWrapperValue; | ||
Optional<V> getIndex(int table, K identifier) throws InternalOperationException; | ||
boolean removeIndex(int table, K identifier) throws InternalOperationException, ImmutableBinaryObjectWrapper.InvalidBinaryObjectWrapperValue; | ||
int size(int table) throws InternalOperationException; | ||
} |
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
Oops, something went wrong.