New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cluster namespace support #119
Add cluster namespace support #119
Conversation
|
||
public String getNamespace() { | ||
return namespace; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
if (namespace != null ? !namespace.equals(cluster.namespace) : cluster.namespace != null) | ||
return false; | ||
return name != null ? name.equals(cluster.name) : cluster.name == null; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra line
public Response findTasks(@QueryParam("namespace") Optional<String> namespace, | ||
@QueryParam("clusterName") Optional<String> clusterName, | ||
@QueryParam("state") Optional<TaskState> state) { | ||
List<Task> result = taskQueue.peekTasks(new Cluster(namespace.get(), clusterName.get()), | ||
state.map(TaskState::intValue).orElse(null)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if namespace and clusterName is not set in the query parameter?
get(): If a value is present in this Optional, returns the value, otherwise throws NoSuchElementException.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should return all tasks.
will add some tests to verify
@ywang282 it's work in progress, i will let you know when it's ready to review |
dc75426
to
334241e
Compare
* @author shu (shu@pinterest.com) | ||
*/ | ||
public class Cluster { | ||
public String namespace; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
*/ | ||
public class Cluster { | ||
public String namespace; | ||
public String name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also can we add some comments on what is namespace and what is name in the cluster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
It is a full stack change, motivation is to divide different clusters into namespace and cluster name. so realpin, rocksdb and scorpion will be 3 namespaces, and cluster name will be the next level in zk path.
Change list: