forked from voldemort/voldemort
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10211c7
commit 35f5681
Showing
14 changed files
with
135 additions
and
172 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package voldemort.client; | ||
|
||
import java.util.HashMap; | ||
|
||
/** | ||
* Encapsulates the timeouts for various voldemort operations | ||
* | ||
*/ | ||
public class TimeoutConfig { | ||
|
||
private HashMap<VoldemortOperation, Long> timeoutMap; | ||
|
||
private boolean partialGetAllAllowed; | ||
|
||
public TimeoutConfig(long globalTimeout, boolean allowPartialGetAlls) { | ||
this(globalTimeout, | ||
globalTimeout, | ||
globalTimeout, | ||
globalTimeout, | ||
globalTimeout, | ||
allowPartialGetAlls); | ||
} | ||
|
||
public TimeoutConfig(long getTimeout, | ||
long putTimeout, | ||
long deleteTimeout, | ||
long getAllTimeout, | ||
long getVersionsTimeout, | ||
boolean allowPartialGetAlls) { | ||
timeoutMap = new HashMap<VoldemortOperation, Long>(); | ||
timeoutMap.put(VoldemortOperation.GET, getTimeout); | ||
timeoutMap.put(VoldemortOperation.PUT, putTimeout); | ||
timeoutMap.put(VoldemortOperation.DELETE, deleteTimeout); | ||
timeoutMap.put(VoldemortOperation.GETALL, getAllTimeout); | ||
timeoutMap.put(VoldemortOperation.GETVERSIONS, getVersionsTimeout); | ||
setPartialGetAllAllowed(allowPartialGetAlls); | ||
} | ||
|
||
public long getOperationTimeout(VoldemortOperation operation) { | ||
assert timeoutMap.containsKey(operation); | ||
return timeoutMap.get(operation); | ||
} | ||
|
||
public void setOperationTimeout(VoldemortOperation operation, long timeoutMs) { | ||
timeoutMap.put(operation, timeoutMs); | ||
} | ||
|
||
public boolean isPartialGetAllAllowed() { | ||
return partialGetAllAllowed; | ||
} | ||
|
||
public void setPartialGetAllAllowed(boolean allowPartialGetAlls) { | ||
this.partialGetAllAllowed = allowPartialGetAlls; | ||
} | ||
|
||
} |
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,14 @@ | ||
package voldemort.client; | ||
|
||
/** | ||
* | ||
* Set of operations supported by Voldemort. | ||
* | ||
*/ | ||
public enum VoldemortOperation { | ||
GET, | ||
PUT, | ||
GETALL, | ||
DELETE, | ||
GETVERSIONS | ||
} |
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.