Filesys::POSIX::Snapshot - Create and operate on filesystem snapshots
use Filesys::POSIX::Snapshot; ... $fs->mkpath('/snapshots/1'); $fs->mount(Filesys::POSIX::Snapshot->new, '/snapshots/1', 'path' => '/' );
This module implements a sort of snapshotting, or copy-on-write, mechanism that allows for the manipulation of any part of a filesystem in an isolated manner that does not affect the original data.
Depending on mount arguments, directory hierarchies are copied into memory as they are encountered, or are copied entirely into memory. Regular files are duplicated only when they are opened with $O_WRONLY or $O_RDWR flags.
$O_WRONLY
$O_RDWR
The following mount arguments are accepted by Filesys::POSIX::Snapshot.
The following value is mandatory:
path
The path within the current virtual filesystem which the snapshot will be based on.
The following value is not mandatory:
immediate_dir_copy
When set to a true value, the entire hierarchy of directory listings and inodes will be duplicated into memory from its source specified in the path value.
Filesys::POSIX::Snapshot->new
Create a new, uninitialized snapshot filesystem object.
$fs->init(%data)
Initializes the new snapshot filesystem. A reference to the %data structure will be retained in the filesystem object.
%data
Exceptions will be thrown for the following:
EINVAL (Invalid argument)
No path value was specified.
ENOENT (No such file or directory)
The path specified in mount argument path does not exist within the current virtual filesystem.
ENOTDIR (Not a directory)
The path specified in mount argument path is not a directory.
Written by Xan Tronix <xan@cpan.org>
Copyright (c) 2014, cPanel, Inc. Distributed under the terms of the Perl Artistic license.
To install Filesys::POSIX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Filesys::POSIX
CPAN shell
perl -MCPAN -e shell install Filesys::POSIX
For more information on module installation, please visit the detailed CPAN module installation guide.