aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/filesystem.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-04-07 16:53:55 +0200
committerGitHub Enterprise <[email protected]>2026-04-07 16:53:55 +0200
commit4d8fae7636ad45900f22253621b9f7d51d0b646e (patch)
tree37fdf97870f216d465b4cb66563c5c366262483d /src/zencore/filesystem.cpp
parentdisable zencompute in bundle step (diff)
downloadzen-4d8fae7636ad45900f22253621b9f7d51d0b646e.tar.xz
zen-4d8fae7636ad45900f22253621b9f7d51d0b646e.zip
incremental dehydrate (#921)
- Feature: Incremental CAS-based hydration/dehydration replacing the previous full-copy approach - Feature: S3 hydration backend with multipart upload/download support - Feature: Configurable thread pools for hub instance provisioning and hydration `--hub-instance-provision-threads` defaults to `max(cpu_count / 4, 2)`. Set to 0 for synchronous operation. `--hub-hydration-threads` defaults to `max(cpu_count / 4, 2)`. Set to 0 for synchronous operation. - Improvement: Hub triggers GC on instance before deprovisioning to compact storage before dehydration - Improvement: GC status now reports pending triggers as running - Improvement: S3 client debug logging gated behind verbose mode to reduce log noise at default verbosity - Improvement: Hub dashboard Resources tile now shows total memory - Improvement: `filesystemutils` moved from `zenremotestore` to `zenutil` for broader reuse - Improvement: Hub uses separate provision and hydration worker pools to avoid deadlocks - Improvement: Hibernate/wake/deprovision on non-existent or already-in-target-state modules are idempotent - Improvement: `ScopedTemporaryDirectory` with empty path now creates a temporary directory instead of asserting
Diffstat (limited to 'src/zencore/filesystem.cpp')
-rw-r--r--src/zencore/filesystem.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/zencore/filesystem.cpp b/src/zencore/filesystem.cpp
index a63594be9..cae6ba5d4 100644
--- a/src/zencore/filesystem.cpp
+++ b/src/zencore/filesystem.cpp
@@ -114,6 +114,20 @@ struct ScopedFd
explicit operator bool() const { return Fd >= 0; }
};
+# if ZEN_PLATFORM_LINUX
+inline uint64_t
+StatMtime100Ns(const struct stat& S)
+{
+ return uint64_t(S.st_mtim.tv_sec) * 10'000'000ULL + uint64_t(S.st_mtim.tv_nsec) / 100;
+}
+# elif ZEN_PLATFORM_MAC
+inline uint64_t
+StatMtime100Ns(const struct stat& S)
+{
+ return uint64_t(S.st_mtimespec.tv_sec) * 10'000'000ULL + uint64_t(S.st_mtimespec.tv_nsec) / 100;
+}
+# endif
+
#endif // ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC
#if ZEN_PLATFORM_WINDOWS
@@ -2123,7 +2137,7 @@ FileSystemTraversal::TraverseFileSystem(const std::filesystem::path& RootDir, Tr
}
else if (S_ISREG(Stat.st_mode))
{
- Visitor.VisitFile(RootDir, FileName, Stat.st_size, gsl::narrow<uint32_t>(Stat.st_mode), gsl::narrow<uint64_t>(Stat.st_mtime));
+ Visitor.VisitFile(RootDir, FileName, Stat.st_size, gsl::narrow<uint32_t>(Stat.st_mode), StatMtime100Ns(Stat));
}
else
{
@@ -2507,7 +2521,7 @@ GetModificationTickFromHandle(void* NativeHandle, std::error_code& Ec)
struct stat Stat;
if (0 == fstat(Fd, &Stat))
{
- return gsl::narrow<uint64_t>(Stat.st_mtime);
+ return StatMtime100Ns(Stat);
}
#endif
Ec = MakeErrorCodeFromLastError();
@@ -2546,7 +2560,7 @@ GetModificationTickFromPath(const std::filesystem::path& Filename)
{
ThrowLastError(fmt::format("Failed to get mode of file {}", Filename));
}
- return gsl::narrow<uint64_t>(Stat.st_mtime);
+ return StatMtime100Ns(Stat);
#endif
}
@@ -2589,7 +2603,7 @@ TryGetFileProperties(const std::filesystem::path& Path,
{
return false;
}
- OutModificationTick = gsl::narrow<uint64_t>(Stat.st_mtime);
+ OutModificationTick = StatMtime100Ns(Stat);
OutSize = size_t(Stat.st_size);
OutNativeModeOrAttributes = (uint32_t)Stat.st_mode;
return true;