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.
Moved AdminClient.QueryKeyResult into its own file.
src/java/voldemort/client/protocol/admin/QueryKeyResult.java - A more complete, proper class based on the inner class that had been in AdminClient.java
- Loading branch information
Showing
4 changed files
with
115 additions
and
80 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
55 changes: 55 additions & 0 deletions
55
src/java/voldemort/client/protocol/admin/QueryKeyResult.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,55 @@ | ||
package voldemort.client.protocol.admin; | ||
|
||
import java.util.List; | ||
|
||
import voldemort.utils.ByteArray; | ||
import voldemort.versioning.Versioned; | ||
|
||
/** | ||
* Return type of AdminClient.QueryKeys. Intended to ensure the following | ||
* invariant: .hasValues() == !.hasException() | ||
*/ | ||
public class QueryKeyResult { | ||
|
||
private final ByteArray key; | ||
private final List<Versioned<byte[]>> values; | ||
private final Exception exception; | ||
|
||
QueryKeyResult(ByteArray key, List<Versioned<byte[]>> values) { | ||
this.key = key; | ||
this.values = values; | ||
this.exception = null; | ||
} | ||
|
||
QueryKeyResult(ByteArray key, Exception exception) { | ||
this.key = key; | ||
this.values = null; | ||
this.exception = exception; | ||
} | ||
|
||
public ByteArray getKey() { | ||
return key; | ||
} | ||
|
||
/** | ||
* @return true iff values were returned. | ||
*/ | ||
public boolean hasValues() { | ||
return (values != null); | ||
} | ||
|
||
public List<Versioned<byte[]>> getValues() { | ||
return values; | ||
} | ||
|
||
/** | ||
* @return true iff exception occured during queryKeys. | ||
*/ | ||
public boolean hasException() { | ||
return (exception != null); | ||
} | ||
|
||
public Exception getException() { | ||
return 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
Oops, something went wrong.