The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Filesys::POSIX::Snapshot - Create and operate on filesystem snapshots

SYNOPSIS

    use Filesys::POSIX::Snapshot;

    ...

    $fs->mkpath('/snapshots/1');

    $fs->mount(Filesys::POSIX::Snapshot->new, '/snapshots/1',
        'path' => '/'
    );

DESCRIPTION

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.

MOUNT ARGUMENTS

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.

CREATING A NEW FILESYSTEM

Filesys::POSIX::Snapshot->new

Create a new, uninitialized snapshot filesystem object.

INITIALIZATION

$fs->init(%data)

Initializes the new snapshot filesystem. A reference to the %data structure will be retained in the filesystem object.

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.

AUTHOR

Written by Xan Tronix <xan@cpan.org>

CONTRIBUTORS

Rikus Goodell <rikus.goodell@cpanel.net>
Brian Carlson <brian.carlson@cpanel.net>

COPYRIGHT

Copyright (c) 2014, cPanel, Inc. Distributed under the terms of the Perl Artistic license.