27 #ifndef BLOCK_COMPRESSOR_HPP
28 #define BLOCK_COMPRESSOR_HPP
30 #include "../my_config.h"
45 class block_compressor:
public proto_compressor
48 block_compressor(std::unique_ptr<compress_module> block_zipper,
49 generic_file & compressed_side,
50 U_I uncompressed_bs = default_uncompressed_block_size);
54 block_compressor(
const block_compressor & ref) =
delete;
55 block_compressor(block_compressor && ref) noexcept =
delete;
56 block_compressor & operator = (
const block_compressor & ref) =
delete;
57 block_compressor & operator = (block_compressor && ref) noexcept =
delete;
63 virtual void suspend_compression()
override;
64 virtual void resume_compression()
override;
65 virtual bool is_compression_suspended()
const override {
return suspended; };
69 virtual bool skippable(skippability direction,
const infinint & amount)
override;
70 virtual bool skip(
const infinint & pos)
override;
71 virtual bool skip_to_eof()
override;
72 virtual bool skip_relative(S_I x)
override;
73 virtual bool truncatable(
const infinint & pos)
const override;
74 virtual infinint get_position()
const override;
77 virtual void inherited_read_ahead(
const infinint & amount)
override { compressed->read_ahead(amount); };
78 virtual U_I inherited_read(
char *a, U_I size)
override;
79 virtual void inherited_write(
const char *a, U_I size)
override;
80 virtual void inherited_truncate(
const infinint & pos)
override;
81 virtual void inherited_sync_write()
override;
82 virtual void inherited_flush_read()
override {
if(
get_mode() !=
gf_write_only) current->reset(); reof =
false; };
83 virtual void inherited_terminate()
override;
86 static constexpr
const U_I min_uncompressed_block_size = 100;
91 std::unique_ptr<compress_module> zipper;
93 U_I uncompressed_block_size;
96 std::unique_ptr<crypto_segment> current;
101 void compress_and_write_current();
102 void read_and_uncompress_current();
generic_file(gf_mode m)
main constructor
gf_mode get_mode() const
retreive the openning mode for this object
provides abstracted interface of per-block compression/decompression
defines unit block of information ciphered as once
compression
the different compression algorithm available
@ gf_write_only
write only access
heap data structure (relying on FIFO)
switch module to limitint (32 ou 64 bits integers) or infinint
libdar namespace encapsulate all libdar symbols
abstracted ancestor class for compressor and parallel_compressor classes