Disk ARchive 2.8.0
Full featured and portable backup and archiving tool
delta_sig_block_size.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2025 Denis Corbin
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
25
26#ifndef DELTA_SIG_BLOCK_SIZE_HPP
27#define DELTA_SIG_BLOCK_SIZE_HPP
28
29#include "../my_config.h"
30
31extern "C"
32{
33} // end extern "C"
34
35#include "infinint.hpp"
36
37#ifndef RS_DEFAULT_BLOCK_LEN
38#define RS_DEFAULT_BLOCK_LEN 2048
39#endif
40
41namespace libdar
42{
44
47
48
50 {
53 {
58 root3
59 // square2 (inexact naming) -> use root2 since release 2.8.0, same behavior just renaming
60 // square3 (inexact naming) -> use root3 since release 2.8.0, same behavior just renaming
61 };
62
68
69 // definitions to help using the struct
70
73 delta_sig_block_size(delta_sig_block_size && ref) noexcept = default;
74 delta_sig_block_size & operator = (const delta_sig_block_size & ref) = default;
75 delta_sig_block_size & operator = (delta_sig_block_size && ref) noexcept = default;
76 ~delta_sig_block_size() = default;
77
78 bool operator == (const delta_sig_block_size & ref) const;
79
81 void reset();
82
84 bool equals_default() { return (*this) == delta_sig_block_size(); };
85
87 void check() const;
88
90
93 U_I calculate(const infinint & filesize) const;
94
95 };
96
97
98} // end of namespace
99
100#endif
the arbitrary large positive integer class
switch module to limitint (32 ou 64 bits integers) or infinint
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47
defines how to calculate delta signature block size based of file size to delta sign
infinint multiplier
function dependently used multiplier
U_I min_block_len
calculated block len will never be lower than that
fs_function_t fs_function
the function to use to calculate the signature block len
void check() const
check the sanity of the provided values
fs_function_t
defines the function to use to derivate block size from file size
@ root2
block size is proportional to the square root of file size
@ root3
block size if proportional to the cube root of the file size
@ log2
block size is proportional to log2(file size)
@ fixed
block size is independant from file size
@ linear
block size if proportionnal to file size
delta_sig_block_size(const delta_sig_block_size &ref)=default
set the structure to defaults value
U_I calculate(const infinint &filesize) const
calculate the value of the block size given the file size
bool equals_default()
whether structure has default values
infinint divisor
function dependently used divisor
U_I max_block_len
calculated block len will never be higer than that except if this field is set to zero (disabling thi...
void reset()
reset to default value