00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __ZTSWatcher_Client__
00026 #define __ZTSWatcher_Client__
00027 #include "zconfig.h"
00028
00029 #include "ZCompat_NonCopyable.h"
00030 #include "ZStreamer.h"
00031 #include "ZTSWatcher.h"
00032
00033
00034 #pragma mark -
00035 #pragma mark * ZTSWatcher_Client
00036
00037 class ZTSWatcher_Client : public ZTSWatcher
00038 {
00039 public:
00040 ZTSWatcher_Client(
00041 bool iSupports2, bool iSupports3, bool iSupports4, ZRef<ZStreamerRW> iStreamerRW);
00042
00043 virtual ~ZTSWatcher_Client();
00044
00045
00046 virtual bool AllocateIDs(size_t iCount, uint64& oBaseID, size_t& oCountIssued);
00047
00048 virtual bool Sync(
00049 const uint64* iRemovedIDs, size_t iRemovedIDsCount,
00050 const uint64* iAddedIDs, size_t iAddedIDsCount,
00051 const int64* iRemovedQueries, size_t iRemovedQueriesCount,
00052 const AddedQueryCombo* iAddedQueries, size_t iAddedQueriesCount,
00053 std::vector<uint64>& oAddedIDs,
00054 std::vector<uint64>& oChangedTupleIDs, std::vector<ZTuple>& oChangedTuples,
00055 const uint64* iWrittenTupleIDs, const ZTuple* iWrittenTuples, size_t iWrittenTuplesCount,
00056 std::map<int64, std::vector<uint64> >& oChangedQueries);
00057
00058 virtual void SetCallback(Callback_t iCallback, void* iRefcon);
00059
00060 private:
00061 void pSync1(
00062 const ZStreamR& iStreamR, const ZStreamW& iStreamW,
00063 const uint64* iRemovedIDs, size_t iRemovedIDsCount,
00064 const uint64* iAddedIDs, size_t iAddedIDsCount,
00065 const int64* iRemovedQueries, size_t iRemovedQueriesCount,
00066 const AddedQueryCombo* iAddedQueries, size_t iAddedQueriesCount,
00067 std::vector<uint64>& oAddedIDs,
00068 std::vector<uint64>& oChangedTupleIDs, std::vector<ZTuple>& oChangedTuples,
00069 const uint64* iWrittenTupleIDs, const ZTuple* iWrittenTuples, size_t iWrittenTuplesCount,
00070 std::map<int64, std::vector<uint64> >& oChangedQueries);
00071
00072 void pSync2(
00073 const ZStreamR& iStreamR, const ZStreamW& iStreamW,
00074 const uint64* iRemovedIDs, size_t iRemovedIDsCount,
00075 const uint64* iAddedIDs, size_t iAddedIDsCount,
00076 const int64* iRemovedQueries, size_t iRemovedQueriesCount,
00077 const AddedQueryCombo* iAddedQueries, size_t iAddedQueriesCount,
00078 std::vector<uint64>& oChangedTupleIDs, std::vector<ZTuple>& oChangedTuples,
00079 const uint64* iWrittenTupleIDs, const ZTuple* iWrittenTuples, size_t iWrittenTuplesCount,
00080 std::map<int64, std::vector<uint64> >& oChangedQueries);
00081
00082 void pSync3(
00083 const ZStreamR& iStreamR, const ZStreamW& iStreamW,
00084 const uint64* iRemovedIDs, size_t iRemovedIDsCount,
00085 const uint64* iAddedIDs, size_t iAddedIDsCount,
00086 const int64* iRemovedQueries, size_t iRemovedQueriesCount,
00087 const AddedQueryCombo* iAddedQueries, size_t iAddedQueriesCount,
00088 std::vector<uint64>& oChangedTupleIDs, std::vector<ZTuple>& oChangedTuples,
00089 const uint64* iWrittenTupleIDs, const ZTuple* iWrittenTuples, size_t iWrittenTuplesCount,
00090 std::map<int64, std::vector<uint64> >& oChangedQueries);
00091
00092 void pSync4(
00093 const ZStreamR& iStreamR, const ZStreamW& iStreamW,
00094 const uint64* iRemovedIDs, size_t iRemovedIDsCount,
00095 const uint64* iAddedIDs, size_t iAddedIDsCount,
00096 const int64* iRemovedQueries, size_t iRemovedQueriesCount,
00097 const AddedQueryCombo* iAddedQueries, size_t iAddedQueriesCount,
00098 std::vector<uint64>& oAddedIDs,
00099 std::vector<uint64>& oChangedTupleIDs, std::vector<ZTuple>& oChangedTuples,
00100 const uint64* iWrittenTupleIDs, const ZTuple* iWrittenTuples, size_t iWrittenTuplesCount,
00101 std::map<int64, std::vector<uint64> >& oChangedQueries);
00102
00103 ZMutex fMutex;
00104 bool const fSupports2;
00105 bool const fSupports3;
00106 bool const fSupports4;
00107 ZRef<ZStreamerRW> fStreamerRW;
00108 };
00109
00110 #endif // __ZTSWatcher_Client__