Ref counting
[iotcloud.git] / version2 / src / C / CommitPart.h
index 606f889816e6bbc83bec4dd8b64a522b74fbd371..7b8be2e8450c76c67a8aa096be23680b73e57706 100644 (file)
@@ -15,6 +15,7 @@ private:
        int64_t transactionSequenceNumber;
        int32_t partNumber;     // Parts position in the
        bool fldisLastPart;
+       int32_t refCount;
        Array<char> *data;
 
        Pair<int64_t, int32_t> partId;
@@ -36,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);