MCPcopy Index your code
hub / github.com/ray-project/ray / ActorId

Class ActorId

java/api/src/main/java/io/ray/api/id/ActorId.java:8–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import java.util.Random;
7
8public class ActorId extends BaseId implements Serializable {
9
10 private static final int UNIQUE_BYTES_LENGTH = 12;
11
12 public static final int LENGTH = JobId.LENGTH + UNIQUE_BYTES_LENGTH;
13
14 public static final ActorId NIL = nil();
15
16 private ActorId(byte[] id) {
17 super(id);
18 }
19
20 public static ActorId fromByteBuffer(ByteBuffer bb) {
21 return new ActorId(byteBuffer2Bytes(bb));
22 }
23
24 public static ActorId fromBytes(byte[] bytes) {
25 return new ActorId(bytes);
26 }
27
28 /** Generate a nil ActorId. */
29 private static ActorId nil() {
30 byte[] b = new byte[LENGTH];
31 Arrays.fill(b, (byte) 0xFF);
32 return new ActorId(b);
33 }
34
35 /** Generate an ActorId with random value. Used for local mode and test only. */
36 public static ActorId fromRandom() {
37 byte[] b = new byte[LENGTH];
38 new Random().nextBytes(b);
39 return new ActorId(b);
40 }
41
42 @Override
43 public int size() {
44 return LENGTH;
45 }
46
47 public JobId getJobId() {
48 byte[] actorBytes = getBytes();
49 ByteBuffer bf = ByteBuffer.wrap(actorBytes, UNIQUE_BYTES_LENGTH, JobId.LENGTH);
50 return JobId.fromByteBuffer(bf);
51 }
52}

Callers

nothing calls this directly

Calls 1

nilMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…