ExcludedFolderCache.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AssetManager/ExcludedFolderCacheInterface.h>
  10. #include <AssetManager/FileStateCache.h>
  11. namespace AssetProcessor
  12. {
  13. class PlatformConfiguration;
  14. struct ExcludedFolderCache : ExcludedFolderCacheInterface
  15. {
  16. explicit ExcludedFolderCache(const PlatformConfiguration* platformConfig);
  17. ~ExcludedFolderCache() override;
  18. // Gets a set of absolute paths to folder which have been excluded according to the platform configuration rules
  19. // Note - not thread safe
  20. const AZStd::unordered_set<AZStd::string>& GetExcludedFolders() override;
  21. void FileAdded(QString path) override;
  22. //! Initialize the cache from a known list of excluded folders, so that it does not have to do a scan
  23. //! for itself. Destroys the input.
  24. void InitializeFromKnownSet(AZStd::unordered_set<AZStd::string>&& excludedFolders);
  25. private:
  26. bool m_builtCache = false;
  27. const PlatformConfiguration* m_platformConfig{};
  28. AZStd::unordered_set<AZStd::string> m_excludedFolders;
  29. AZStd::recursive_mutex m_pendingNewFolderMutex;
  30. AZStd::unordered_set<AZStd::string> m_pendingNewFolders; // Newly ignored folders waiting to be added to m_excludedFolders
  31. AZStd::unordered_set<AZStd::string> m_pendingDeletes;
  32. AZ::Event<FileStateInfo>::Handler m_handler;
  33. };
  34. }