// Make a Key which is homed to specific nodes. public static Key make(byte[] kb, byte rf, byte systemType, H2ONode... replicas) { // no more than 3 replicas allowed to be stored in the key assert 0 <= replicas.length && replicas.length <= 3; assert systemType < 32; // only system keys allowed // Key byte layout is: // 0 - systemType, from 0-31 // 1 - replica-count, plus up to 3 bits for ip4 vs ip6 // 2-n - zero, one, two or 3 IP4 (4+2 bytes) or IP6 (16+2 bytes) addresses // 2-5- 4 bytes of chunk#, or -1 for masters // n+ - repeat of the original kb AutoBuffer ab = new AutoBuffer(); ab.put1(systemType).put1(replicas.length); for (H2ONode h2o : replicas) h2o.write(ab); ab.put4(-1); ab.putA1(kb, kb.length); return make(Arrays.copyOf(ab.buf(), ab.position()), rf); }