BackupPC::XS(3) User Contributed Perl Documentation BackupPC::XS(3)

BackupPC::XS - Perl extension for BackupPC libraries

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

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.

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();

Pool file reference counting:

$countDB = BackupPC::XS::PoolRefCnt::new(initialEntryCnt);
$refCount = $countDB->get($digest);
$countDB->set($digest, $refCount);
$countDB->incr($digest, $refIncr);
($digest, $refCnt, $idx) = $countDB->iterate($idx);

Pool file delta accumulation:

BackupPC::XS::PoolRefCnt::DeltaUpdate($digest, $refIncr);

Writing and matching files in the pool:

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

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_....);

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);
$attrHash = $ac->getInode($inode, $allocateIfMissing);
$ac->setInode($inode, $attrHash);
$ac->getAll($path, $dontReadInode);
$ac->flush($all, $path);

$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::Lib::ConfInit($topDir, $hardLinkMax, $poolV3Enabled, $logLevel)
$messageArrayRef = BackupPC::XS::Lib::logMsgGet();
$errorCnt = BackupPC::XS::Lib::logErrorCntGet;

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



Craig Barratt, <<gt>

BackupPC code is copyright (C) 2013-2017 Craig Barratt <>.

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 website.

2023-07-25 perl v5.38.0