CopyOnWrite 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package CopyOnWrite --version 0.1.1                
NuGet\Install-Package CopyOnWrite -Version 0.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CopyOnWrite" Version="0.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CopyOnWrite --version 0.1.1                
#r "nuget: CopyOnWrite, 0.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CopyOnWrite as a Cake Addin
#addin nuget:?package=CopyOnWrite&version=0.1.1

// Install CopyOnWrite as a Cake Tool
#tool nuget:?package=CopyOnWrite&version=0.1.1                

This library provides a .NET layer on top of OS-specific logic that provides copy-on-write linking for files (a.k.a. CoW, file cloning, or reflinking). CoW linking provides the ability to copy a file without actually copying the original file's bytes from one disk location to another. The filesystem is in charge of ensuring that if the original file is modified or deleted, the CoW linked files remain unmodified by lazily copying the original file's bytes into each link. Unlike symlinks or hardlinks, writes to CoW links do not write through to the original file, as the filesystem breaks the link and copies in a lazy fashion. This enables scenarios like file caches where a single copy of a file held in a content-addressable or other store is safely linked to many locations in a filesystem with low I/O overhead.

This library allows a .NET developer to:

  • Discover whether CoW links are allowed between two filesystem paths,
  • Discover whether CoW links are allowed for a directory tree based at a specific root directory,
  • Create CoW links.
  • Find filesystem CoW link limits.

Discovery is important, as different operating systems and different filesystems available for those operating systems provide varying levels of CoW link support:

  • Windows: The default NTFS filesystem does NOT support CoW, but the ReFS filesystem does.
  • Linux: Btrfs, Xfs, Zfs support CoW while ext4 does not.
  • Mac: AppleFS supports CoW by default.

When using this library you may need to create a wrapper that copies the file if CoW is not available.

Example

using Microsoft.CopyOnWrite;

ICopyOnWriteFilesystem cow = CopyOnWriteFilesystemFactory.GetInstance();
bool canCloneInCurrentDirectory = cow.CopyOnWriteLinkSupportedInDirectoryTree(Environment.CurrentDirectory);
if (canCloneInCurrentDirectory)
{
    cow.CloneFile(existingFile, cowLinkFilePath);
}

Release History

  • 0.1.1 October 2021: Bug fixes for Windows. Mac and Linux throw NotSupportedException.
  • 0.1.0 July 2021: Windows ReFS support. Mac and Linux throw NotSupportedException.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CopyOnWrite:

Package Downloads
Microsoft.MSBuildCache.Common

A project cache plugin for MSBuild

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on CopyOnWrite:

Repository Stars
microsoft/MSBuildSdks
MSBuild project SDKs
Version Downloads Last updated
0.4.2 173 11/4/2024
0.4.1 127 10/28/2024
0.4.0 95 10/14/2024
0.3.12 153 10/14/2024
0.3.11 218 9/24/2024
0.3.10 133 9/23/2024
0.3.9 111 9/23/2024
0.3.8 12,025 3/25/2024
0.3.7 8,117 9/11/2023
0.3.6 7,923 7/17/2023
0.3.5 203 7/13/2023
0.3.4 223 7/12/2023
0.3.3 209 7/11/2023
0.3.2 9,024 2/9/2023
0.3.1 342 2/8/2023
0.3.0 1,090 1/30/2023
0.2.2 407 1/27/2023
0.2.1 5,911 9/27/2022
0.2.0 478 9/15/2022
0.1.13 475 9/15/2022
0.1.12 486 9/15/2022
0.1.11 470 9/6/2022
0.1.10 430 9/3/2022
0.1.9 411 9/3/2022
0.1.8 523 4/19/2022
0.1.7 505 4/19/2022
0.1.6 445 4/19/2022
0.1.5 377 10/15/2021
0.1.4 367 10/14/2021
0.1.3 358 10/13/2021
0.1.2 352 10/13/2021
0.1.1 390 10/11/2021
0.1.0 407 7/10/2021