ArchiveStateCollector.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef ARCHIVESTATECOLLECTOR_H_INCLUDED
  18. #define ARCHIVESTATECOLLECTOR_H_INCLUDED
  19. #include <map>
  20. #include <memory>
  21. #include <kopano/zcdefs.h>
  22. #include "archivestateupdater_fwd.h"
  23. #include "ArchiverSessionPtr.h" // For ArchiverSessionPtr
  24. #include <kopano/archiver-common.h>
  25. #include "ECArchiverLogger.h"
  26. namespace KC {
  27. class ArchiveStateCollector;
  28. typedef std::shared_ptr<ArchiveStateCollector> ArchiveStateCollectorPtr;
  29. /**
  30. * The ArchiveStateCollector will construct the current archive state, which
  31. * is the set of currently attached archives for each primary store, and the
  32. * should-be archive state, which is the set of attached archives for each
  33. * primary store as specified in LDAP/ADS.
  34. */
  35. class _kc_export ArchiveStateCollector _kc_final {
  36. public:
  37. static HRESULT Create(const ArchiverSessionPtr &ptrSession, ECLogger *lpLogger, ArchiveStateCollectorPtr *lpptrCollector);
  38. _kc_hidden ~ArchiveStateCollector(void);
  39. HRESULT GetArchiveStateUpdater(ArchiveStateUpdaterPtr *lpptrUpdater);
  40. struct ArchiveInfo {
  41. tstring userName;
  42. entryid_t storeId;
  43. std::list<tstring> lstServers;
  44. std::list<tstring> lstCouplings;
  45. ObjectEntryList lstArchives;
  46. };
  47. typedef std::map<abentryid_t, ArchiveInfo> ArchiveInfoMap;
  48. private:
  49. _kc_hidden ArchiveStateCollector(const ArchiverSessionPtr &, ECLogger *);
  50. _kc_hidden HRESULT PopulateUserList(void);
  51. _kc_hidden HRESULT PopulateFromContainer(LPABCONT container);
  52. ArchiverSessionPtr m_ptrSession;
  53. ECArchiverLogger *m_lpLogger;
  54. ArchiveInfoMap m_mapArchiveInfo;
  55. };
  56. } /* namespace */
  57. #endif // !defined ARCHIVESTATECOLLECTOR_H_INCLUDED