]>
Commit | Line | Data |
---|---|---|
31f18b77 FG |
1 | /* |
2 | * Ceph - scalable distributed file system | |
3 | * | |
4 | * Copyright (C) 2017 XSKY Inc. | |
5 | * | |
6 | * Author: Haomai Wang <haomaiwang@gmail.com> | |
7 | * | |
8 | * This library is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License as published by the Free Software Foundation; either | |
11 | * version 2.1 of the License, or (at your option) any later version. | |
12 | * | |
13 | */ | |
14 | ||
15 | #ifndef CEPH_COMPRESSION_PLUGIN_LZ4_H | |
16 | #define CEPH_COMPRESSION_PLUGIN_LZ4_H | |
17 | ||
18 | // ----------------------------------------------------------------------------- | |
19 | #include "ceph_ver.h" | |
20 | #include "compressor/CompressionPlugin.h" | |
21 | #include "LZ4Compressor.h" | |
22 | // ----------------------------------------------------------------------------- | |
23 | ||
f67539c2 | 24 | class CompressionPluginLZ4 : public ceph::CompressionPlugin { |
31f18b77 FG |
25 | |
26 | public: | |
27 | ||
28 | explicit CompressionPluginLZ4(CephContext* cct) : CompressionPlugin(cct) | |
29 | {} | |
30 | ||
31 | int factory(CompressorRef *cs, std::ostream *ss) override { | |
32 | if (compressor == 0) { | |
11fdf7f2 | 33 | LZ4Compressor *interface = new LZ4Compressor(cct); |
31f18b77 FG |
34 | compressor = CompressorRef(interface); |
35 | } | |
36 | *cs = compressor; | |
37 | return 0; | |
38 | } | |
39 | }; | |
40 | ||
41 | #endif |