diff options
| author | Stefan Boberg <[email protected]> | 2021-10-28 13:58:28 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-10-28 13:58:28 +0200 |
| commit | e140ec960bec2a3c2b867361af35b312a5bbc53d (patch) | |
| tree | f04bb05d0906948b8acd53c7efbd69dd5e4c4db5 /zenserver/projectstore.h | |
| parent | Merge remote-tracking branch 'origin/main' into gc (diff) | |
| download | zen-e140ec960bec2a3c2b867361af35b312a5bbc53d.tar.xz zen-e140ec960bec2a3c2b867361af35b312a5bbc53d.zip | |
gc: Implemented initial root gathering for projects/oplogs
Diffstat (limited to 'zenserver/projectstore.h')
| -rw-r--r-- | zenserver/projectstore.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/zenserver/projectstore.h b/zenserver/projectstore.h index 83d3986bb..743abb5eb 100644 --- a/zenserver/projectstore.h +++ b/zenserver/projectstore.h @@ -9,6 +9,7 @@ #include <zenstore/cas.h> #include <zenstore/caslog.h> #include <zenstore/cidstore.h> +#include <zenstore/gc.h> #include <filesystem> #include <map> @@ -49,12 +50,12 @@ static_assert(IsPow2(sizeof(OplogEntry))); /** Project Store */ -class ProjectStore : public RefCounted +class ProjectStore : public RefCounted, public GcContributor { struct OplogStorage; public: - ProjectStore(CidStore& Store, std::filesystem::path BasePath); + ProjectStore(CidStore& Store, std::filesystem::path BasePath, CasGc& Gc); ~ProjectStore(); struct Project; @@ -105,7 +106,8 @@ public: spdlog::logger& Log() { return m_OuterProject->Log(); } void Flush(); - void Scrub(ScrubContext& Ctx); + void Scrub(ScrubContext& Ctx) const; + void GatherReferences(GcContext& GcCtx) const; std::size_t OplogCount() const { return m_LatestOpMap.size(); } @@ -124,7 +126,7 @@ public: std::filesystem::path m_BasePath; std::filesystem::path m_TempPath; - RwLock m_OplogLock; + mutable RwLock m_OplogLock; OidMap<IoHash> m_ChunkMap; // output data chunk id -> CAS address OidMap<IoHash> m_MetaMap; // meta chunk id -> CAS address OidMap<FileMapEntry> m_FileMap; // file id -> file map entry @@ -161,6 +163,7 @@ public: void Flush(); void Scrub(ScrubContext& Ctx); spdlog::logger& Log(); + void GatherReferences(GcContext& GcCtx); private: ProjectStore* m_ProjectStore; @@ -188,6 +191,8 @@ public: spdlog::logger& Log() { return m_Log; } const std::filesystem::path& BasePath() const { return m_ProjectBasePath; } + virtual void GatherReferences(GcContext& GcCtx) override; + private: spdlog::logger& m_Log; CidStore& m_CidStore; |