BackupPC::XS(3)
๐ฆ BackupPC::XS โ the Perl extension for the BackupPC libraries ๐
okay bestie, so this is a page from the User Contributed Perl Documentation, and it's literally the manual for BackupPC::XS, the Perl extension that gives you all the BackupPC library functions. it's giving "backstage pass to the pool" energy. let's get into it ๐
โจ NAME โจ
BackupPC::XS โ the Perl extension for the BackupPC libraries. periodt.
๐ธ SYNOPSIS ๐ธ
use BackupPC::XS;
use BackupPC::XS qw( :all );
that's it, that's the vibe check. ๐
๐ DESCRIPTION ๐
BackupPC::XS hands you a bunch of submodules, and each one implements some BackupPC library functions. the sections below go through every submodule one by one, no skipping. ๐
real talk though: this documentation is very terse. BackupPC::XS is not meant to be a general-purpose module โ it's closely tied to BackupPC, like, soulmate-level tied. if you want actual examples of using it, go look in the BackupPC code. iykyk. ๐ซถ
๐๏ธ BackupPC::XS::FileZIO
compressed file I/O using zlib โ the main character of file compression:
$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 โ keeping track of who's holding onto what:
$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();
and pool file delta accumulation, aka the receipts-collecting squad:
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 โ this one ate and left no crumbs:
$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 โ usually one directory's worth at a time, lowkey cozy:
$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
maintaining a cache of directories, with full share/path semantics โ the whole share/path situation, fully handled:
$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
directory operations, the practical bestie of the group:
$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
the utility drawer โ init things, grab log messages, count errors, set the log level:
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 (peep the SYNOPSIS above ๐), then the BPC_FTYPE_ values get exported. that's the whole deal, slay.
๐ SEE ALSO ๐
BackupPCbackuppc.sourceforge.netrsync-bpc
go read those too, bestie, they're iconic in their own right. ๐
โ๏ธ AUTHOR โ๏ธ
Craig Barratt, <cbarratt@users.sourceforge.net<gt>
โ๏ธ COPYRIGHT AND LICENSE โ๏ธ
BackupPC code is copyright (C) 2013-2017 Craig Barratt <cbarratt@users.sourceforge.net>.
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. ๐ญ (yes that's the scary all-caps part, it means it, fr fr)
you should have received a copy of the GNU General Public License along with this program; if not, visit the http://fsf.org website.
๐ reminder bestie: this module is tightly coupled to BackupPC, not a general-purpose grab-and-go thing. don't just yeet it into random projects, okay? ๐ซถ
and that's the whole page! this beauty came to you as perl v5.32.1, dated 2023-01-18 โ shoutout to that version and that date, they ate. bye bestie, go compress some files ๐ โจ๐
๐ฆ where this page comes from
- epel 9: BackupPC-XS 0.62-11.el9 ยท GPLv3+ and (GPL+ or Artistic) and zlib
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms