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 static Entry decode(Slot slot, ByteBuffer bb) {
31 int keylength = bb.getInt();
32 byte[] key = new byte[keylength];
34 long machineid = bb.getLong();
36 return new NewKey(slot, IoTString.shallow(key), machineid);
39 public void encode(ByteBuffer bb) {
40 bb.put(Entry.TypeAbort);
41 bb.putInt(key.length());
42 bb.put(key.internalBytes());
43 bb.putLong(machineid);
46 public int getSize() {
47 return Long.BYTES + Byte.BYTES + key.length();
50 public byte getType() {
51 return Entry.TypeNewKey;
54 public Entry getCopy(Slot s) {
55 return new NewKey(s, key, machineid);