Adding benchmark file for encrypted cloud storage.
[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         int32_t refCount;
19         Array<char> *data;
20
21         Pair<int64_t, int32_t> partId;
22         Pair<int64_t, int64_t> commitId;
23
24 public:
25         CommitPart(Slot *s, int64_t _machineId, int64_t _sequenceNumber, int64_t _transactionSequenceNumber, int _partNumber, Array<char> *_data, bool _isLastPart);
26         ~CommitPart();
27         int getSize();
28         int getPartNumber();
29         int getDataSize();
30         Array<char> *getData();
31         Pair<int64_t, int32_t> * getPartId();
32         Pair<int64_t, int64_t> getCommitId();
33         bool isLastPart();
34         int64_t getMachineId();
35         int64_t getTransactionSequenceNumber();
36         int64_t getSequenceNumber();
37         void encode(ByteBuffer *bb);
38         char getType();
39         Entry *getCopy(Slot *s);
40         void releaseRef() {if ((--refCount)==0) delete this;}   
41         void acquireRef() {refCount++;}
42 };
43
44 Entry *CommitPart_decode(Slot *s, ByteBuffer *bb);
45 #endif