Skip to content

Commit

Permalink
[Streaming] Change ID caption (ray-project#10523)
Browse files Browse the repository at this point in the history
  • Loading branch information
lixin-wei authored Sep 3, 2020
1 parent 2f03bb5 commit 2597b56
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package io.ray.streaming.runtime.core.common;

import com.google.common.base.MoreObjects;
import io.ray.streaming.runtime.core.resource.ContainerID;
import io.ray.streaming.runtime.core.resource.ContainerId;
import java.io.Serializable;
import java.util.UUID;

/**
* Streaming system unique identity base class. For example, ${@link ContainerID }
* Streaming system unique identity base class. For example, ${@link ContainerId }
*/
public class AbstractID implements Serializable {
public class AbstractId implements Serializable {

private UUID id;

public AbstractID() {
public AbstractId() {
this.id = UUID.randomUUID();
}

@Override
public boolean equals(Object obj) {
return id.equals(((AbstractID) obj).getId());
return id.equals(((AbstractId) obj).getId());
}

public UUID getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.ray.streaming.jobgraph.VertexType;
import io.ray.streaming.operator.StreamOperator;
import io.ray.streaming.runtime.config.master.ResourceConfig;
import io.ray.streaming.runtime.core.resource.ContainerID;
import io.ray.streaming.runtime.core.resource.ContainerId;
import io.ray.streaming.runtime.core.resource.ResourceType;
import java.io.Serializable;
import java.util.ArrayList;
Expand Down Expand Up @@ -58,7 +58,7 @@ public class ExecutionVertex implements Serializable {
/**
* The id of the container which this vertex's worker actor belongs to.
*/
private ContainerID containerId;
private ContainerId containerId;

/**
* Worker actor handle.
Expand Down Expand Up @@ -211,15 +211,15 @@ public long getBuildTime() {
return buildTime;
}

public ContainerID getContainerId() {
public ContainerId getContainerId() {
return containerId;
}

public void setContainerId(ContainerID containerId) {
public void setContainerId(ContainerId containerId) {
this.containerId = containerId;
}

public void setContainerIfNotExist(ContainerID containerId) {
public void setContainerIfNotExist(ContainerId containerId) {
if (null == this.containerId) {
this.containerId = containerId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Container implements Serializable {
/**
* container id
*/
private ContainerID id;
private ContainerId id;

/**
* Container address
Expand Down Expand Up @@ -64,7 +64,7 @@ public Container(
UniqueId nodeId, String hostname,
Map<String, Double> availableResources) {

this.id = new ContainerID();
this.id = new ContainerId();
this.address = address;
this.hostname = hostname;
this.nodeId = nodeId;
Expand All @@ -80,11 +80,11 @@ public static Container from(NodeInfo nodeInfo) {
);
}

public ContainerID getId() {
public ContainerId getId() {
return id;
}

public void setId(ContainerID id) {
public void setId(ContainerId id) {
this.id = id;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.ray.streaming.runtime.core.resource;

import io.ray.streaming.runtime.core.common.AbstractId;

/**
* Container unique identifier.
*/
public class ContainerId extends AbstractId {

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package io.ray.streaming.runtime.master.resourcemanager;

import io.ray.streaming.runtime.core.resource.ContainerID;
import io.ray.streaming.runtime.core.resource.ContainerId;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* Cluster resource allocation view, used to statically view cluster resource information.
*/
public class ResourceAssignmentView extends HashMap<ContainerID, List<Integer>> {
public class ResourceAssignmentView extends HashMap<ContainerId, List<Integer>> {

public static ResourceAssignmentView of(Map<ContainerID, List<Integer>> assignmentView) {
public static ResourceAssignmentView of(Map<ContainerId, List<Integer>> assignmentView) {
ResourceAssignmentView view = new ResourceAssignmentView();
view.putAll(assignmentView);
return view;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.ray.streaming.runtime.master.resourcemanager;

import io.ray.streaming.runtime.core.resource.Container;
import io.ray.streaming.runtime.core.resource.ContainerID;
import io.ray.streaming.runtime.core.resource.ContainerId;
import java.util.List;
import java.util.Map;

Expand All @@ -15,7 +15,7 @@ public ViewBuilder() {
}

public static ResourceAssignmentView buildResourceAssignmentView(List<Container> containers) {
Map<ContainerID, List<Integer>> assignmentView =
Map<ContainerId, List<Integer>> assignmentView =
containers.stream().collect(java.util.stream.Collectors.toMap(Container::getId,
Container::getExecutionVertexIds));

Expand Down

0 comments on commit 2597b56

Please sign in to comment.