diff options
| author | Dan Engelbrecht <[email protected]> | 2022-06-17 07:06:21 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-17 07:06:21 -0700 |
| commit | c7e22a4ef1cce7103b9afbeec487461cb32f8dbe (patch) | |
| tree | 8b99d51bf496c96f82161c18fbdcfd5c6f8f31fd /zen/chunk/chunk.cpp | |
| parent | fixed merge mistake which caused a build error (diff) | |
| download | archived-zen-c7e22a4ef1cce7103b9afbeec487461cb32f8dbe.tar.xz archived-zen-c7e22a4ef1cce7103b9afbeec487461cb32f8dbe.zip | |
Make cas storage an hidden implementation detail of CidStore (#130)v0.1.4-pre6v0.1.4-pre5
- Bumped ZEN_SCHEMA_VERSION
- CasStore no longer a public API, it is hidden behind CidStore
- Moved cas.h from public header folder
- CidStore no longer maps from Cid -> Cas, we store entries in Cas under RawHash
- CasStore now decompresses data to validate content (matching against RawHash)
- CasChunkSet renames to HashKeySet and put in separate header/cpp file
- Disabled "Chunk" command for now as it relied on CAS being exposed as a service
- Changed CAS http service to Cid http server
- Moved "Run" command completely inside ZEN_WITH_EXEC_SERVICES define
- Removed "cas.basic" test
- Uncommented ".exec.basic" test and added return-skip at start of test
- Moved ScrubContext to separate header file
- Renamed CasGC to GcManager
- Cleaned up configuration passing in cas store classes
- Removed CAS stuff from GcContext and clarified naming in class
- Remove migration code
Diffstat (limited to 'zen/chunk/chunk.cpp')
| -rw-r--r-- | zen/chunk/chunk.cpp | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/zen/chunk/chunk.cpp b/zen/chunk/chunk.cpp index 42ea8eddc..3fd7c4c1f 100644 --- a/zen/chunk/chunk.cpp +++ b/zen/chunk/chunk.cpp @@ -2,39 +2,39 @@ #include "chunk.h" -#include <gsl/gsl-lite.hpp> - -#include <zencore/filesystem.h> -#include <zencore/iohash.h> -#include <zencore/logging.h> -#include <zencore/refcount.h> -#include <zencore/scopeguard.h> -#include <zencore/sha1.h> -#include <zencore/string.h> -#include <zencore/testing.h> -#include <zencore/thread.h> -#include <zencore/timer.h> -#include <zenstore/cas.h> -#include <zenstore/gc.h> - -#include "../internalfile.h" - -#include <lz4.h> -#include <zstd.h> - -#if ZEN_PLATFORM_WINDOWS -# include <ppl.h> -# include <ppltasks.h> -#endif // ZEN_PLATFORM_WINDOWS - -#include <cmath> -#include <filesystem> -#include <random> -#include <vector> +#if 0 +# include <gsl/gsl-lite.hpp> + +# include <zencore/filesystem.h> +# include <zencore/iohash.h> +# include <zencore/logging.h> +# include <zencore/refcount.h> +# include <zencore/scopeguard.h> +# include <zencore/sha1.h> +# include <zencore/string.h> +# include <zencore/testing.h> +# include <zencore/thread.h> +# include <zencore/timer.h> +# include <zenstore/gc.h> + +# include "../internalfile.h" + +# include <lz4.h> +# include <zstd.h> + +# if ZEN_PLATFORM_WINDOWS +# include <ppl.h> +# include <ppltasks.h> +# endif // ZEN_PLATFORM_WINDOWS + +# include <cmath> +# include <filesystem> +# include <random> +# include <vector> ////////////////////////////////////////////////////////////////////////// -#if ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC +# if ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC namespace Concurrency { @@ -75,7 +75,7 @@ struct task_group } // namespace Concurrency -#endif // ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC +# endif // ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC ////////////////////////////////////////////////////////////////////////// @@ -595,9 +595,9 @@ protected: { zen::RwLock HashLock; std::unordered_set<zen::IoHash, zen::IoHash::Hasher> Hashes; -#if ZEN_PLATFORM_WINDOWS -# pragma warning(suppress : 4324) // Padding due to alignment -#endif +# if ZEN_PLATFORM_WINDOWS +# pragma warning(suppress : 4324) // Padding due to alignment +# endif }; Bucket m_Buckets[256]; @@ -902,7 +902,7 @@ public: m_BufferManager.ReturnBuffer(Buffer); -#if 0 +# if 0 Active.AddCount(); // needs fixing Concurrency::create_task([this, Zfile, CurrentPosition, DataPointer, &Active] { @@ -934,7 +934,7 @@ public: _aligned_free(CompressBuffer); }); -#endif +# endif } StatsBlock& Stats = m_StatsBlock.local(); @@ -990,7 +990,7 @@ ChunkCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) std::unique_ptr<zen::CasStore> CasStore; - zen::CasGc Gc; + zen::GcManager Gc; if (!m_RootDirectory.empty()) { @@ -1056,14 +1056,14 @@ ChunkCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) zen::Stopwatch timer; -#if 1 +# if 1 Concurrency::parallel_for_each(begin(Files), end(Files), [&Chunker](const auto& ThisFile) { Chunker.ChunkFile(ThisFile); }); -#else +# else for (const auto& ThisFile : Files) { Chunker.ChunkFile(ThisFile); } -#endif +# endif uint64_t ElapsedMs = timer.GetElapsedTimeMs(); @@ -1106,7 +1106,7 @@ ChunkCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) ////////////////////////////////////////////////////////////////////////// -#if ZEN_WITH_TESTS +# if ZEN_WITH_TESTS TEST_CASE("chunking") { using namespace zen; @@ -1209,4 +1209,5 @@ TEST_CASE("chunking") SUBCASE("mod method") { test(/* UseThreshold */ false, /* Random */ Random, 2048, 1 * 1024 * 1024); } } +# endif #endif |