BackupPC::XS

NAME

BackupPC::XS − Perl extension for BackupPC libraries

SYNOPSIS

use BackupPC::XS;
use BackupPC::XS qw( :all );

DESCRIPTION

BackupPC::XS provides various submodules that implement various BackupPC library functions. The following sections describe each submodule.

This documentation is very terse. BackupPC::XS is not intended to be a general-purpose module − it is closely tied to BackupPC. Look in the BackupPC code to see examples of using this module.

BackupPC::XS::FileZIO
Compressed file I/O using zlib:

$fd = BackupPC::XS::FileZIO::open($fileName, $writeFlag, $compressLevel);
$fd = BackupPC::XS::FileZIO::fdopen($stream, $writeFlag, $compressLevel);
$nWrite = $fd−>write($dataRef);
$nRead = $fd−>read($dataRef, $maxRead);
$textLine = $fd−>readLine();
$fd−>rewind();
$fd−>close();
$fd−>writeTeeStderr($boolean);

BackupPC::XS::PoolRefCnt
Pool file reference counting:

$countDB = BackupPC::XS::PoolRefCnt::new(initialEntryCnt);
$refCount = $countDB−>get($digest);
$countDB−>set($digest, $refCount);
$countDB−>delete($digest);
$countDB−>incr($digest, $refIncr);
($digest, $refCnt, $idx) = $countDB−>iterate($idx);
$countDB−>read($fileName);
$countDB−>write($fileName);
$countDB−>print();

Pool file delta accumulation:

BackupPC::XS::PoolRefCnt::DeltaFileInit($hostDir);
BackupPC::XS::PoolRefCnt::DeltaFileFlush();
BackupPC::XS::PoolRefCnt::DeltaUpdate($digest, $refIncr);
BackupPC::XS::PoolRefCnt::DeltaPrint();

BackupPC::XS::PoolWrite
Writing and matching files in the pool:

$poolWrite = BackupPC::XS::PoolWrite::new($compressLevel [, $digest]);
$poolWrite−>write($dataRef);
($match, $digest, $poolSize, $error) = $poolWrite−>close();
$poolWrite−>addToPool($fileName, $isV3PoolFile);

BackupPC::XS::Attrib
Manipulating a set of files and attributes (typically one directory’s worth):

$a = BackupPC::XS::Attrib::new($compressLevel);
$attrHash = $a−>get($fileName);
$a−>set($fileName, $attrHash);
$numDirEntries = $a−>count();
$a−>read($dirPath, $attribFileName);
$a−>write($dirPath, $attribFileName);
$textType = BackupPC::XS::Attrib::fileType2Text(BPC_FTYPE_....);

BackupPC::XS::AttribCache
Maintain a cache of directories, with full share/path semantics.

$ac = BackupPC::XS::AttribCache::new($host, $backupNum, $shareNameUM, $compress);
$attrHash = $ac−>get($fileName, $allocateIfMissing, $dontReadInode);
$ac−>set($fileName, $attrHash, $dontOverwriteInode);
$ac−>delete($fileName);
$attrHash = $ac−>getInode($inode, $allocateIfMissing);
$ac−>setInode($inode, $attrHash);
$ac−>deleteInode($inode);
$ac−>getAll($path, $dontReadInode);
$ac−>flush($all, $path);
$ac−>getFullMangledPath($path);

BackupPC::XS::DirOps
$zeroMeansOk = BackupPC::XS::DirOps::path_create($path);
$errorCnt = BackupPC::XS::DirOps::path_remove($path, $compress);
$errorCnt = BackupPC::XS::DirOps::refCountAll($path, $compress);
$lockFd = BackupPC::XS::DirOps::lockRangeFile($lockFile, $offset, $len, $block);
BackupPC::XS::DirOps::unlockRangeFile($lockFd);

BackupPC::XS::Lib
BackupPC::XS::Lib::ConfInit($topDir, $hardLinkMax, $poolV3Enabled, $logLevel)
$messageArrayRef = BackupPC::XS::Lib::logMsgGet();
$errorCnt = BackupPC::XS::Lib::logErrorCntGet;
BackupPC::XS::Lib::logLevelSet($level);

EXPORTS

If you specify :all (see SYNOPSIS ), then the BPC_FTYPE_ values are exported.

SEE ALSO

BackupPC, backuppc.sourceforge.net.

rsync-bpc.

AUTHOR

Craig Barratt, <[email protected]<gt>

COPYRIGHT AND LICENSE

BackupPC code is copyright (C) 2013−2017 Craig Barratt <[email protected]>.

bpc_hashTable.c is based on code from rsync. Rsync is Copyright (C) 1996−2001 by Andrew Tridgell, 1996 by Paul Mackerras, 2001−2002 by Martin Pool, and 2003−2009 by Wayne Davison, and others.

The md5 library is from the rsync codebase, and is Copyright (C) 2001−2003 Christophe Devine. See the code for the license.

The zlib library is from the rsync codebase, and is Copyright (C) 1995−2005 Jean-loup Gailly and Mark Adler. See the code for the license.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, visit the http://fsf.org website.