edits
[iotcloud.git] / version2 / src / C / CommitPart.h
1 #ifndef COMMITPART_H
2 #define COMMITPART_H
3 #include "common.h"
4 #include "Entry.h"
5
6 // Max size of the part excluding the fixed size header
7 #define CommitPart_MAX_NON_HEADER_SIZE 512
8
9 class CommitPart : public Entry {
10  private:
11         // Sequence number of the transaction this commit is for, -1 if not a cloud transaction
12         int64_t machineId;              // Machine Id of the device that made the commit
13         int64_t sequenceNumber; // commit sequence number for this arbitrator
14         int64_t transactionSequenceNumber;
15         int32_t partNumber;     // Parts position in the
16         bool isLastPart;
17         Array<char> * data;
18         
19         Pair<int64_t int32_t> * partId;
20         Pair<int64_t, int64_t> * commitId;
21         
22  public:
23         CommitPart(Slot *s, int64_t _machineId, int64_t _sequenceNumber, int64_t _transactionSequenceNumber, int _partNumber, Array<char>* _data, bool _isLastPart);
24         int getSize();
25         void setSlot(Slot *s);
26         int getPartNumber();
27         int getDataSize();
28         Array<char> * getData();
29         Pair<int64_t int32_t> * getPartId();
30         Pair<int64_t, int64_t> * getCommitId();
31         bool isLastPart();
32         int64_t getMachineId();
33         int64_t getTransactionSequenceNumber();
34         int64_t getSequenceNumber();
35         void encode(ByteBuffer *bb);
36         char getType();
37         Entry* getCopy(Slot *s);
38 };
39
40 Entry * CommitPart_decode(Slot * s, ByteBuffer *bb);
41 #endif