]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | /* | |
4 | * Ceph distributed storage system | |
5 | * | |
6 | * Copyright (C) 2015 Mirantis, Inc. | |
7 | * | |
8 | * Author: Alyona Kiseleva <akiselyova@mirantis.com> | |
9 | * | |
10 | * This library is free software; you can redistribute it and/or | |
11 | * modify it under the terms of the GNU Lesser General Public | |
12 | * License as published by the Free Software Foundation; either | |
13 | * version 2.1 of the License, or (at your option) any later version. | |
14 | * | |
15 | */ | |
16 | ||
17 | #include <unistd.h> | |
18 | ||
19 | #include "ceph_ver.h" | |
20 | #include "compressor/CompressionPlugin.h" | |
21 | #include "compressor_example.h" | |
22 | ||
20effc67 TL |
23 | using namespace std; |
24 | ||
7c673cae FG |
25 | class CompressorPluginExample : public CompressionPlugin { |
26 | public: | |
27 | ||
28 | explicit CompressorPluginExample(CephContext* cct) : CompressionPlugin(cct) | |
29 | {} | |
30 | ||
31 | int factory(CompressorRef *cs, | |
32 | ostream *ss) override | |
33 | { | |
34 | if (compressor == 0) { | |
35 | CompressorExample *interface = new CompressorExample(); | |
36 | compressor = CompressorRef(interface); | |
37 | } | |
38 | *cs = compressor; | |
39 | return 0; | |
40 | } | |
41 | }; | |
42 | ||
43 | // ----------------------------------------------------------------------------- | |
44 | ||
45 | const char *__ceph_plugin_version() | |
46 | { | |
47 | return CEPH_GIT_NICE_VER; | |
48 | } | |
49 | ||
50 | // ----------------------------------------------------------------------------- | |
51 | ||
52 | int __ceph_plugin_init(CephContext *cct, | |
53 | const std::string& type, | |
54 | const std::string& name) | |
55 | { | |
56 | PluginRegistry *instance = cct->get_plugin_registry(); | |
57 | ||
58 | return instance->add(type, name, new CompressorPluginExample(cct)); | |
59 | } |