From fb3fbd34211a28b27214abe070c46951057258ca Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 14 Feb 2020 03:19:21 -0500 Subject: removed lastAccessed from FileEntry, not used FileRegister keeps a vector instead of a map --- src/shared/directoryentry.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/shared/directoryentry.h') diff --git a/src/shared/directoryentry.h b/src/shared/directoryentry.h index 94ea068d..74d50625 100644 --- a/src/shared/directoryentry.h +++ b/src/shared/directoryentry.h @@ -64,6 +64,8 @@ class FileRegister; struct DirectoryStats { + static constexpr bool EnableInstrumentation = true; + std::string mod; std::chrono::nanoseconds dirTimes; @@ -127,11 +129,6 @@ public: return m_Index; } - time_t lastAccessed() const - { - return m_LastAccessed; - } - void addOrigin( int origin, FILETIME fileTime, std::wstring_view archive, int order); @@ -222,8 +219,6 @@ private: uint64_t m_FileSize, m_CompressedFileSize; mutable std::mutex m_OriginsMutex; - time_t m_LastAccessed; - bool recurseParents(std::wstring &path, const DirectoryEntry *parent) const; }; @@ -265,8 +260,8 @@ public: std::vector getFiles() const; FileEntry::Ptr findFile(FileEntry::Index index) const; - void enable(bool enabled, DirectoryStats& stats, time_t notAfter = LONG_MAX); - void enable(bool enabled, time_t notAfter = LONG_MAX); + void enable(bool enabled, DirectoryStats& stats); + void enable(bool enabled); bool isDisabled() const { @@ -313,24 +308,30 @@ public: FileEntry::Ptr getFile(FileEntry::Index index) const; - size_t size() const + size_t highestCount() const { std::scoped_lock lock(m_Mutex); return m_Files.size(); } + void reserve(std::size_t n) + { + m_Files.reserve(n); + } + bool removeFile(FileEntry::Index index); void removeOrigin(FileEntry::Index index, int originID); - void removeOriginMulti(std::set indices, int originID, time_t notAfter); + void removeOriginMulti(std::set indices, int originID); void sortOrigins(); private: - using FileMap = std::map; + using FileMap = std::vector; mutable std::mutex m_Mutex; FileMap m_Files; boost::shared_ptr m_OriginConnection; + std::atomic m_NextIndex; void unregisterFile(FileEntry::Ptr file); FileEntry::Index generateIndex(); -- cgit v1.3.1