.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "BackupPC::XS 3pm" .TH BackupPC::XS 3pm 2024-01-10 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME BackupPC::XS \- Perl extension for BackupPC libraries .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use BackupPC::XS; \& use BackupPC::XS qw( :all ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" BackupPC::XS provides various submodules that implement various BackupPC library functions. The following sections describe each submodule. .PP 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. .SS BackupPC::XS::FileZIO .IX Subsection "BackupPC::XS::FileZIO" Compressed file I/O using zlib: .PP .Vb 8 \& $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); .Ve .SS BackupPC::XS::PoolRefCnt .IX Subsection "BackupPC::XS::PoolRefCnt" Pool file reference counting: .PP .Vb 9 \& $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(); .Ve .PP Pool file delta accumulation: .PP .Vb 4 \& BackupPC::XS::PoolRefCnt::DeltaFileInit($hostDir); \& BackupPC::XS::PoolRefCnt::DeltaFileFlush(); \& BackupPC::XS::PoolRefCnt::DeltaUpdate($digest, $refIncr); \& BackupPC::XS::PoolRefCnt::DeltaPrint(); .Ve .SS BackupPC::XS::PoolWrite .IX Subsection "BackupPC::XS::PoolWrite" Writing and matching files in the pool: .PP .Vb 4 \& $poolWrite = BackupPC::XS::PoolWrite::new($compressLevel [, $digest]); \& $poolWrite\->write($dataRef); \& ($match, $digest, $poolSize, $error) = $poolWrite\->close(); \& $poolWrite\->addToPool($fileName, $isV3PoolFile); .Ve .SS BackupPC::XS::Attrib .IX Subsection "BackupPC::XS::Attrib" Manipulating a set of files and attributes (typically one directory's worth): .PP .Vb 6 \& $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_....); .Ve .SS BackupPC::XS::AttribCache .IX Subsection "BackupPC::XS::AttribCache" Maintain a cache of directories, with full share/path semantics. .PP .Vb 1 \& $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); .Ve .SS BackupPC::XS::DirOps .IX Subsection "BackupPC::XS::DirOps" .Vb 2 \& $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); .Ve .SS BackupPC::XS::Lib .IX Subsection "BackupPC::XS::Lib" .Vb 1 \& BackupPC::XS::Lib::ConfInit($topDir, $hardLinkMax, $poolV3Enabled, $logLevel) \& \& $messageArrayRef = BackupPC::XS::Lib::logMsgGet(); \& $errorCnt = BackupPC::XS::Lib::logErrorCntGet; \& BackupPC::XS::Lib::logLevelSet($level); .Ve .SH EXPORTS .IX Header "EXPORTS" If you specify :all (see SYNOPSIS), then the BPC_FTYPE_ values are exported. .SH "SEE ALSO" .IX Header "SEE ALSO" BackupPC, backuppc.sourceforge.net. .PP rsync-bpc. .SH AUTHOR .IX Header "AUTHOR" Craig Barratt, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" BackupPC code is copyright (C) 2013\-2017 Craig Barratt . .PP 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. .PP The md5 library is from the rsync codebase, and is Copyright (C) 2001\-2003 Christophe Devine. See the code for the license. .PP 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. .PP 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. .PP 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. .PP You should have received a copy of the GNU General Public License along with this program; if not, visit the http://fsf.org website.