#file #cp #coreutils #gitignore

libxcp

libxcp is a high-level file-copy engine with support for multi-threading, fine-grained progress feedback, pluggable drivers, and .gitignore filters. libxcp provides the core functionality of xcp.

10 releases (6 breaking)

0.23.1 Dec 18, 2024
0.23.0 Oct 28, 2024
0.22.1 Sep 2, 2024
0.22.0 Jun 22, 2024
0.21.1 Feb 23, 2024

#715 in Filesystem

Download history 96/week @ 2024-09-11 61/week @ 2024-09-18 89/week @ 2024-09-25 95/week @ 2024-10-02 139/week @ 2024-10-09 76/week @ 2024-10-16 276/week @ 2024-10-23 172/week @ 2024-10-30 106/week @ 2024-11-06 73/week @ 2024-11-13 67/week @ 2024-11-20 46/week @ 2024-11-27 54/week @ 2024-12-04 54/week @ 2024-12-11 317/week @ 2024-12-18 52/week @ 2024-12-25

483 downloads per month
Used in xcp

GPL-3.0-only

100KB
2K SLoC

libxcp: High-level file-copy engine

libxcp is a high-level file-copy engine. It has a support for multi-threading, fine-grained progress feedback, pluggable drivers, and .gitignore filters. libxcp is the core functionality of the xcp command-line utility.

Crates.io doc.rs Github Actions CircleCI

Features

  • On Linux it uses copy_file_range call to copy files. This is the most efficient method of file-copying under Linux; in particular it is filesystem-aware, and can massively speed-up copies on network mounts by performing the copy operations server-side. However, unlike copy_file_range sparse files are detected and handled appropriately.
  • Support for modern filesystem features such as reflinks.
  • Optimised for 'modern' systems (i.e. multiple cores, copious RAM, and solid-state disks, especially ones connected into the main system bus, e.g. NVMe).
  • Optional aggressive parallelism for systems with parallel IO. Quick experiments on a modern laptop suggest there may be benefits to parallel copies on NVMe disks. This is obviously highly system-dependent.
  • Switchable 'drivers' to facilitate experimenting with alternative strategies for copy optimisation. Currently 2 drivers are available:
    • 'parfile': the previous hard-coded xcp copy method, which parallelises tree-walking and per-file copying. This is the default.
    • 'parblock': An experimental driver that parallelises copying at the block level. This has the potential for performance improvements in some architectures, but increases complexity. Testing is welcome.
  • Non-Linux Unix-like OSs (OS X, *BSD) are supported via fall-back operation (although sparse-files are not yet supported in this case).
  • Optionally understands .gitignore files to limit the copied directories.

Testing

libxcp itself doesn't have many tests; the top-level xcp application however has a full functional test suite, including fuzzed stress-tests. This should be considered the test suite for now.

Dependencies

~16–25MB
~474K SLoC