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