aboutsummaryrefslogtreecommitdiff
path: root/zenstore
diff options
context:
space:
mode:
Diffstat (limited to 'zenstore')
-rw-r--r--zenstore/CAS.cpp28
-rw-r--r--zenstore/gc.cpp31
-rw-r--r--zenstore/include/zenstore/CAS.h20
-rw-r--r--zenstore/include/zenstore/gc.h21
4 files changed, 54 insertions, 46 deletions
diff --git a/zenstore/CAS.cpp b/zenstore/CAS.cpp
index a4bbfa340..807bba3b3 100644
--- a/zenstore/CAS.cpp
+++ b/zenstore/CAS.cpp
@@ -67,34 +67,6 @@ CasChunkSet::IterateChunks(std::function<void(const IoHash& ChunkHash)>&& Callba
//////////////////////////////////////////////////////////////////////////
-struct GcContext::GcState
-{
- CasChunkSet m_CasChunks;
- CasChunkSet m_CidChunks;
-};
-
-GcContext::GcContext() : m_State(std::make_unique<GcState>())
-{
-}
-
-GcContext::~GcContext()
-{
-}
-
-void
-GcContext::ContributeCids(std::span<const IoHash> Cids)
-{
- m_State->m_CidChunks.AddChunksToSet(Cids);
-}
-
-void
-GcContext::ContributeCas(std::span<const IoHash> Cas)
-{
- m_State->m_CasChunks.AddChunksToSet(Cas);
-}
-
-//////////////////////////////////////////////////////////////////////////
-
void
ScrubContext::ReportBadCasChunks(std::span<IoHash> BadCasChunks)
{
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp
index bfb8f015e..e7c8f3a1a 100644
--- a/zenstore/gc.cpp
+++ b/zenstore/gc.cpp
@@ -1,9 +1,40 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include <zenstore/gc.h>
+#include <zenstore/CAS.h>
namespace zen {
+//////////////////////////////////////////////////////////////////////////
+
+struct GcContext::GcState
+{
+ CasChunkSet m_CasChunks;
+ CasChunkSet m_CidChunks;
+};
+
+GcContext::GcContext() : m_State(std::make_unique<GcState>())
+{
+}
+
+GcContext::~GcContext()
+{
+}
+
+void
+GcContext::ContributeCids(std::span<const IoHash> Cids)
+{
+ m_State->m_CidChunks.AddChunksToSet(Cids);
+}
+
+void
+GcContext::ContributeCas(std::span<const IoHash> Cas)
+{
+ m_State->m_CasChunks.AddChunksToSet(Cas);
+}
+
+//////////////////////////////////////////////////////////////////////////
+
CasGc::CasGc(CasStore& Store) : m_CasStore(Store)
{
}
diff --git a/zenstore/include/zenstore/CAS.h b/zenstore/include/zenstore/CAS.h
index 86e7e78d9..dc7e260ab 100644
--- a/zenstore/include/zenstore/CAS.h
+++ b/zenstore/include/zenstore/CAS.h
@@ -19,6 +19,8 @@
namespace zen {
+class GcContext;
+
struct CasStoreConfiguration
{
// Root directory for CAS store
@@ -50,24 +52,6 @@ private:
std::unordered_set<IoHash> m_ChunkSet;
};
-/** Garbage Collection context object
- */
-
-class GcContext
-{
-public:
- GcContext();
- ~GcContext();
-
- void ContributeCids(std::span<const IoHash> Cid);
- void ContributeCas(std::span<const IoHash> Hash);
-
-private:
- struct GcState;
-
- std::unique_ptr<GcState> m_State;
-};
-
/** Context object for data scrubbing
*
* Data scrubbing is when we traverse stored data to validate it and
diff --git a/zenstore/include/zenstore/gc.h b/zenstore/include/zenstore/gc.h
index 055843547..33a43f4d2 100644
--- a/zenstore/include/zenstore/gc.h
+++ b/zenstore/include/zenstore/gc.h
@@ -11,6 +11,27 @@ namespace zen {
class CasStore;
struct IoHash;
+/** Garbage Collection context object
+ */
+
+class GcContext
+{
+public:
+ GcContext();
+ ~GcContext();
+
+ void ContributeCids(std::span<const IoHash> Cid);
+ void ContributeCas(std::span<const IoHash> Hash);
+
+private:
+ struct GcState;
+
+ std::unique_ptr<GcState> m_State;
+};
+
+/** GC
+ */
+
class CasGc
{
public: