aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/include
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-10-11 20:30:01 +0200
committerGitHub Enterprise <[email protected]>2025-10-11 20:30:01 +0200
commitac6d1838d7b9d1a49f064bc67c027e0dda5348bb (patch)
treef31f2da84564c735dbccc507628f034e6a29468f /src/zencore/include
parentadd ability to limit concurrency (#565) (diff)
downloadzen-ac6d1838d7b9d1a49f064bc67c027e0dda5348bb.tar.xz
zen-ac6d1838d7b9d1a49f064bc67c027e0dda5348bb.zip
block reference couting copy support windows (#564)
- Improvement: On Windows file systems that allow block reference counting we use it where possible to speed up copy of data during `zen builds download` operations - Enabled by default, disable with `--allow-file-clone=false`
Diffstat (limited to 'src/zencore/include')
-rw-r--r--src/zencore/include/zencore/filesystem.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/zencore/include/zencore/filesystem.h b/src/zencore/include/zencore/filesystem.h
index 36d4d1b68..92b249cec 100644
--- a/src/zencore/include/zencore/filesystem.h
+++ b/src/zencore/include/zencore/filesystem.h
@@ -179,6 +179,29 @@ ZENCORE_API void WriteFile(void* NativeHandle,
std::error_code& Ec);
ZENCORE_API void ReadFile(void* NativeHandle, void* Data, uint64_t Size, uint64_t FileOffset, uint64_t ChunkSize, std::error_code& Ec);
+class CloneQueryInterface
+{
+public:
+ virtual ~CloneQueryInterface() {}
+
+ virtual bool CanClone(void* SourceNativeHandle) = 0;
+ virtual uint64_t GetClonableRange(uint64_t SourceOffset,
+ uint64_t TargetOffset,
+ uint64_t Size,
+ uint64_t& OutPreBytes,
+ uint64_t& OutPostBytes) = 0;
+ virtual bool TryClone(void* SourceNativeHandle,
+ void* TargetNativeHandle,
+ uint64_t AlignedSourceOffset,
+ uint64_t AlignedTargetOffset,
+ uint64_t AlignedSize,
+ uint64_t TargetFinalSize) = 0;
+};
+
+ZENCORE_API std::unique_ptr<CloneQueryInterface> GetCloneQueryInterface(const std::filesystem::path& TargetDirectory);
+
+ZENCORE_API bool TryCloneFile(const std::filesystem::path& FromPath, const std::filesystem::path& ToPath);
+
struct CopyFileOptions
{
bool EnableClone = true;