3 import java.nio.ByteBuffer;
6 * This Entry records the abort sent by a given machine.
7 * @author Ali Younis <ayounis@uci.edu>
12 class NewKey extends Entry {
13 private IoTString key;
14 private long machineid;
16 public NewKey(Slot slot, IoTString _key, long _machineid) {
19 machineid = _machineid;
22 public long getMachineID() {
26 public IoTString getKey() {
30 public void setSlot(Slot s) {
34 static Entry decode(Slot slot, ByteBuffer bb) {
35 int keylength = bb.getInt();
36 byte[] key = new byte[keylength];
38 long machineid = bb.getLong();
40 return new NewKey(slot, IoTString.shallow(key), machineid);
43 public void encode(ByteBuffer bb) {
44 bb.put(Entry.TypeNewKey);
45 bb.putInt(key.length());
46 bb.put(key.internalBytes());
47 bb.putLong(machineid);
50 public int getSize() {
51 return Long.BYTES + Byte.BYTES + Integer.BYTES + key.length();
54 public byte getType() {
55 return Entry.TypeNewKey;
58 public Entry getCopy(Slot s) {
59 return new NewKey(s, key, machineid);