TFIO - Transactional File I/O
TFIO is a library that provides a Transaction-like interface that are traditionally used in databases on FileIO operations. It gives the flexibility to execute and rollback singlular operations as well as transactions on the fly. The library also provides a builder-pattern interface to chain operations and execute them in one go.
Features
- 100% safe code (thanks to Rust)
- 10 rollback-able File/Directory operations
- Only 1 Third-party dependency
- All
Errorsexposed for handling - 100% Tests passing
Usage
Import the library in your Rust project:
use *;
Create a transaction and execute it. If any Error is encountered, rollback the entire transaction:
Note: The paths should only use forward slashes (/) and can either begin with disks or relative to the present working directory ie. begin with ./
use io;
use *;
You can also import single operations to use:
use io;
use ;
To run tests:
$ git clone https://github.com/GandalfTheGrayOfHell/tfio
$ cd tfio
$ cargo test
Note: Some TFIO operations create temporary files and directories in the TEMP_PATH provided. If an operation requires a path to temp dir then it will also require either the SingleFileOperation trait or the DirectoryOperation trait. Hence import them as per need.
Roadmap
It is unlikely that this project receives any updates. It is supposed to be a building block for a future project and works just enough to get things done. There are a couple of places where this library could use help:
- Handling of
Writebuffers - Path normalization
PRs are always appreciated :)