}
static Entry decode(Slot s, ByteBuffer bb) {
- int64_t machineId = bb.getLong();
- int64_t sequenceNumber = bb.getLong();
- int64_t transactionSequenceNumber = bb.getLong();
- int partNumber = bb.getInt();
- int dataSize = bb.getInt();
- Boolean isLastPart = bb.get() == 1;
+ int64_t machineId = bb->getLong();
+ int64_t sequenceNumber = bb->getLong();
+ int64_t transactionSequenceNumber = bb->getLong();
+ int partNumber = bb->getInt();
+ int dataSize = bb->getInt();
+ Boolean isLastPart = bb->get() == 1;
// Get the data
char[] data = new char[dataSize];
- bb.get(data);
+ bb->get(data);
return new CommitPart(s, machineId, sequenceNumber, transactionSequenceNumber, partNumber, data, isLastPart);
}
void encode(ByteBuffer bb) {
- bb.put(Entry.TypeCommitPart);
- bb.putLong(machineId);
- bb.putLong(sequenceNumber);
- bb.putLong(transactionSequenceNumber);
- bb.putInt(partNumber);
- bb.putInt(data.length);
+ bb->put(Entry.TypeCommitPart);
+ bb->putLong(machineId);
+ bb->putLong(sequenceNumber);
+ bb->putLong(transactionSequenceNumber);
+ bb->putInt(partNumber);
+ bb->putInt(data.length);
if (isLastPart) {
- bb.put((char)1);
+ bb->put((char)1);
} else {
- bb.put((char)0);
+ bb->put((char)0);
}
- bb.put(data);
+ bb->put(data);
}
char getType() {
}
static Entry decode(Slot s, ByteBuffer bb) {
- int64_t machineId = bb.getLong();
- int64_t sequenceNumber = bb.getLong();
- int64_t transactionSequenceNumber = bb.getLong();
- int partNumber = bb.getInt();
- int dataSize = bb.getInt();
- Boolean isLastPart = bb.get() == 1;
+ int64_t machineId = bb->getLong();
+ int64_t sequenceNumber = bb->getLong();
+ int64_t transactionSequenceNumber = bb->getLong();
+ int partNumber = bb->getInt();
+ int dataSize = bb->getInt();
+ Boolean isLastPart = bb->get() == 1;
// Get the data
char[] data = new char[dataSize];
- bb.get(data);
+ bb->get(data);
return new CommitPart(s, machineId, sequenceNumber, transactionSequenceNumber, partNumber, data, isLastPart);
}
public void encode(ByteBuffer bb) {
- bb.put(Entry.TypeCommitPart);
- bb.putLong(machineId);
- bb.putLong(sequenceNumber);
- bb.putLong(transactionSequenceNumber);
- bb.putInt(partNumber);
- bb.putInt(data.length);
+ bb->put(Entry.TypeCommitPart);
+ bb->putLong(machineId);
+ bb->putLong(sequenceNumber);
+ bb->putLong(transactionSequenceNumber);
+ bb->putInt(partNumber);
+ bb->putInt(data.length);
if (isLastPart) {
- bb.put((char)1);
+ bb->put((char)1);
} else {
- bb.put((char)0);
+ bb->put((char)0);
}
- bb.put(data);
+ bb->put(data);
}
public char getType() {
*/
Entry * Entry_decode(Slot * slot, ByteBuffer * bb) {
- char type = bb.get();
+ char type = bb->get();
switch (type) {
case TypeCommitPart:
}
static KeyValue decode(ByteBuffer bb) {
- int keylength = bb.getInt();
- int valuelength = bb.getInt();
+ int keylength = bb->getInt();
+ int valuelength = bb->getInt();
char[] key = new char[keylength];
- bb.get(key);
+ bb->get(key);
if (valuelength != 0) {
char[] value = new char[valuelength];
- bb.get(value);
+ bb->get(value);
return new KeyValue(IoTString.shallow(key), IoTString.shallow(value));
}
}
void encode(ByteBuffer bb) {
- bb.putInt(key.length());
+ bb->putInt(key.length());
if (value != NULL) {
- bb.putInt(value.length());
+ bb->putInt(value.length());
} else {
- bb.putInt(0);
+ bb->putInt(0);
}
- bb.put(key.internalBytes());
+ bb->put(key.internalBytes());
if (value != NULL) {
- bb.put(value.internalBytes());
+ bb->put(value.internalBytes());
}
}
}
static KeyValue decode(ByteBuffer bb) {
- int keylength = bb.getInt();
- int valuelength = bb.getInt();
+ int keylength = bb->getInt();
+ int valuelength = bb->getInt();
char[] key = new char[keylength];
- bb.get(key);
+ bb->get(key);
if (valuelength != 0) {
char[] value = new char[valuelength];
- bb.get(value);
+ bb->get(value);
return new KeyValue(IoTString.shallow(key), IoTString.shallow(value));
}
}
public void encode(ByteBuffer bb) {
- bb.putInt(key.length());
+ bb->putInt(key.length());
if (value != NULL) {
- bb.putInt(value.length());
+ bb->putInt(value.length());
} else {
- bb.putInt(0);
+ bb->putInt(0);
}
- bb.put(key.internalBytes());
+ bb->put(key.internalBytes());
if (value != NULL) {
- bb.put(value.internalBytes());
+ bb->put(value.internalBytes());
}
}
}
static Entry decode(Slot slot, ByteBuffer bb) {
- int64_t machineid=bb.getLong();
- int64_t seqnum=bb.getLong();
+ int64_t machineid=bb->getLong();
+ int64_t seqnum=bb->getLong();
return new LastMessage(slot, machineid, seqnum);
}
void encode(ByteBuffer bb) {
- bb.put(Entry.TypeLastMessage);
- bb.putLong(machineid);
- bb.putLong(seqnum);
+ bb->put(Entry.TypeLastMessage);
+ bb->putLong(machineid);
+ bb->putLong(seqnum);
}
int getSize() {
}
static Entry decode(Slot slot, ByteBuffer bb) {
- int64_t machineid=bb.getLong();
- int64_t seqnum=bb.getLong();
+ int64_t machineid=bb->getLong();
+ int64_t seqnum=bb->getLong();
return new LastMessage(slot, machineid, seqnum);
}
public void encode(ByteBuffer bb) {
- bb.put(Entry.TypeLastMessage);
- bb.putLong(machineid);
- bb.putLong(seqnum);
+ bb->put(Entry.TypeLastMessage);
+ bb->putLong(machineid);
+ bb->putLong(seqnum);
}
public int getSize() {
*/
Entry * RejectedMessage_decode(Slot * slot, ByteBuffer * bb) {
- int64_t sequencenum=bb.getLong();
- int64_t machineid=bb.getLong();
- int64_t oldseqnum=bb.getLong();
- int64_t newseqnum=bb.getLong();
- char equalto=bb.get();
+ int64_t sequencenum=bb->getLong();
+ int64_t machineid=bb->getLong();
+ int64_t oldseqnum=bb->getLong();
+ int64_t newseqnum=bb->getLong();
+ char equalto=bb->get();
return new RejectedMessage(slot,sequencenum, machineid, oldseqnum, newseqnum, equalto==1);
}
}
void RejectedMessage::encode(ByteBuffer * bb) {
- bb.put(TypeRejectedMessage);
+ bb->put(TypeRejectedMessage);
bb->putLong(sequencenum);
bb->putLong(machineid);
bb->putLong(oldseqnum);
#include "ByteBuffer.h"
Entry * TableStatus_decode(Slot * slot, ByteBuffer * bb) {
- int maxslots=bb.getInt();
+ int maxslots=bb->getInt();
return new TableStatus(slot, maxslots);
}
}
static Entry decode(Slot s, ByteBuffer bb) {
- int64_t sequenceNumber = bb.getLong();
- int64_t machineId = bb.getLong();
- int64_t arbitratorId = bb.getLong();
- int64_t clientLocalSequenceNumber = bb.getLong();
- int partNumber = bb.getInt();
- int dataSize = bb.getInt();
- Boolean isLastPart = (bb.get() == 1);
+ int64_t sequenceNumber = bb->getLong();
+ int64_t machineId = bb->getLong();
+ int64_t arbitratorId = bb->getLong();
+ int64_t clientLocalSequenceNumber = bb->getLong();
+ int partNumber = bb->getInt();
+ int dataSize = bb->getInt();
+ Boolean isLastPart = (bb->get() == 1);
// Get the data
char[] data = new char[dataSize];
- bb.get(data);
+ bb->get(data);
TransactionPart returnTransactionPart = new TransactionPart(s, machineId, arbitratorId, clientLocalSequenceNumber, partNumber, data, isLastPart);
returnTransactionPart.setSequenceNumber(sequenceNumber);
}
void encode(ByteBuffer bb) {
- bb.put(Entry.TypeTransactionPart);
- bb.putLong(sequenceNumber);
- bb.putLong(machineId);
- bb.putLong(arbitratorId);
- bb.putLong(clientLocalSequenceNumber);
- bb.putInt(partNumber);
- bb.putInt(data.length);
+ bb->put(Entry.TypeTransactionPart);
+ bb->putLong(sequenceNumber);
+ bb->putLong(machineId);
+ bb->putLong(arbitratorId);
+ bb->putLong(clientLocalSequenceNumber);
+ bb->putInt(partNumber);
+ bb->putInt(data.length);
if (isLastPart) {
- bb.put((char)1);
+ bb->put((char)1);
} else {
- bb.put((char)0);
+ bb->put((char)0);
}
- bb.put(data);
+ bb->put(data);
}
char getType() {
}
static Entry decode(Slot s, ByteBuffer bb) {
- int64_t sequenceNumber = bb.getLong();
- int64_t machineId = bb.getLong();
- int64_t arbitratorId = bb.getLong();
- int64_t clientLocalSequenceNumber = bb.getLong();
- int partNumber = bb.getInt();
- int dataSize = bb.getInt();
- Boolean isLastPart = (bb.get() == 1);
+ int64_t sequenceNumber = bb->getLong();
+ int64_t machineId = bb->getLong();
+ int64_t arbitratorId = bb->getLong();
+ int64_t clientLocalSequenceNumber = bb->getLong();
+ int partNumber = bb->getInt();
+ int dataSize = bb->getInt();
+ Boolean isLastPart = (bb->get() == 1);
// Get the data
char[] data = new char[dataSize];
- bb.get(data);
+ bb->get(data);
TransactionPart returnTransactionPart = new TransactionPart(s, machineId, arbitratorId, clientLocalSequenceNumber, partNumber, data, isLastPart);
returnTransactionPart.setSequenceNumber(sequenceNumber);
}
public void encode(ByteBuffer bb) {
- bb.put(Entry.TypeTransactionPart);
- bb.putLong(sequenceNumber);
- bb.putLong(machineId);
- bb.putLong(arbitratorId);
- bb.putLong(clientLocalSequenceNumber);
- bb.putInt(partNumber);
- bb.putInt(data.length);
+ bb->put(Entry.TypeTransactionPart);
+ bb->putLong(sequenceNumber);
+ bb->putLong(machineId);
+ bb->putLong(arbitratorId);
+ bb->putLong(clientLocalSequenceNumber);
+ bb->putInt(partNumber);
+ bb->putInt(data.length);
if (isLastPart) {
- bb.put((char)1);
+ bb->put((char)1);
} else {
- bb.put((char)0);
+ bb->put((char)0);
}
- bb.put(data);
+ bb->put(data);
}
public char getType() {