Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / compressor / snappy / CompressionPluginSnappy.h
1 /*
2  * Ceph - scalable distributed file system
3  *
4  * Copyright (C) 2015 Mirantis, Inc.
5  *
6  * Author: Alyona Kiseleva <akiselyova@mirantis.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_SNAPPY_H
16 #define CEPH_COMPRESSION_PLUGIN_SNAPPY_H
17
18 // -----------------------------------------------------------------------------
19 #include "compressor/CompressionPlugin.h"
20 #include "SnappyCompressor.h"
21 // -----------------------------------------------------------------------------
22
23 class CompressionPluginSnappy : public CompressionPlugin {
24
25 public:
26
27   explicit CompressionPluginSnappy(CephContext* cct) : CompressionPlugin(cct)
28   {}
29
30   int factory(CompressorRef *cs,
31                       std::ostream *ss) override
32   {
33     if (compressor == 0) {
34       SnappyCompressor *interface = new SnappyCompressor();
35       compressor = CompressorRef(interface);
36     }
37     *cs = compressor;
38     return 0;
39   }
40 };
41
42 #endif