27#ifndef BLOCK_COMPRESSOR_HPP
28#define BLOCK_COMPRESSOR_HPP
30#include "//include/dar/libdar_my_config.h"
32#include "//include/dar/infinint.hpp"
33#include "//include/dar/crypto_segment.hpp"
34#include "//include/dar/heap.hpp"
35#include "//include/dar/compress_module.hpp"
36#include "//include/dar/proto_compressor.hpp"
45 class block_compressor:
public proto_compressor
48 block_compressor(std::unique_ptr<compress_module> block_zipper,
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;
72 virtual bool skip_relative(S_I x)
override;
73 virtual bool truncatable(
const infinint & pos)
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;
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();
virtual void inherited_sync_write()=0
write down any pending data
generic_file(gf_mode m)
main constructor
virtual infinint get_position() const =0
get the current read/write position
virtual bool skip_to_eof()=0
skip to the end of file
gf_mode get_mode() const
retreive the openning mode for this object
virtual void inherited_terminate()=0
destructor-like call, except that it is allowed to throw exceptions
virtual void inherited_flush_read()=0
reset internal engine, flush caches in order to read the data at current position
compression
the different compression algorithm available
@ gf_write_only
write only access
libdar namespace encapsulate all libdar symbols