1
#pragma once
2

            
3
#include "envoy/buffer/buffer.h"
4

            
5
namespace Envoy {
6
namespace Compression {
7
namespace Compressor {
8

            
9
/**
10
 * Compressor state whether to flush the compressor or to finish the compression stream.
11
 */
12
enum class State { Flush, Finish };
13

            
14
/**
15
 * Allows compressing data.
16
 */
17
class Compressor {
18
public:
19
671
  virtual ~Compressor() = default;
20

            
21
  /**
22
   * Compresses data buffer.
23
   * @param buffer supplies the reference to data to be compressed. The content of the buffer will
24
   *        be replaced inline with the compressed data.
25
   * @param state supplies the compressor state.
26
   */
27
  virtual void compress(Buffer::Instance& buffer, State state) PURE;
28
};
29

            
30
using CompressorPtr = std::unique_ptr<Compressor>;
31

            
32
} // namespace Compressor
33
} // namespace Compression
34
} // namespace Envoy