X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=version2%2Fsrc%2FC%2FCommitPart.h;h=7b8be2e8450c76c67a8aa096be23680b73e57706;hb=44e35968685635bb5c8b28e89a0dafcfe5d1645b;hp=6d179982a424f2b569f55c079bd5f8f7a8a402d7;hpb=2345e7ea95433815c8cae09c3b719820e0ba44cd;p=iotcloud.git diff --git a/version2/src/C/CommitPart.h b/version2/src/C/CommitPart.h index 6d17998..7b8be2e 100644 --- a/version2/src/C/CommitPart.h +++ b/version2/src/C/CommitPart.h @@ -2,6 +2,7 @@ #define COMMITPART_H #include "common.h" #include "Entry.h" +#include "Pair.h" // Max size of the part excluding the fixed size header #define CommitPart_MAX_NON_HEADER_SIZE 512 @@ -13,21 +14,22 @@ private: int64_t sequenceNumber; // commit sequence number for this arbitrator int64_t transactionSequenceNumber; int32_t partNumber; // Parts position in the - bool isLastPart; + bool fldisLastPart; + int32_t refCount; Array *data; - Pair *partId; - Pair *commitId; + Pair partId; + Pair commitId; public: CommitPart(Slot *s, int64_t _machineId, int64_t _sequenceNumber, int64_t _transactionSequenceNumber, int _partNumber, Array *_data, bool _isLastPart); + ~CommitPart(); int getSize(); - void setSlot(Slot *s); int getPartNumber(); int getDataSize(); Array *getData(); - Pair *getPartId(); - Pair *getCommitId(); + Pair * getPartId(); + Pair getCommitId(); bool isLastPart(); int64_t getMachineId(); int64_t getTransactionSequenceNumber(); @@ -35,6 +37,8 @@ public: void encode(ByteBuffer *bb); char getType(); Entry *getCopy(Slot *s); + void releaseRef() {if ((--refCount)==0) delete this;} + void acquireRef() {refCount++;} }; Entry *CommitPart_decode(Slot *s, ByteBuffer *bb);