]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/erasure-code/ErasureCodePluginExample.cc
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / test / erasure-code / ErasureCodePluginExample.cc
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) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
7 * Copyright (C) 2014 Red Hat <contact@redhat.com>
8 *
9 * Author: Loic Dachary <loic@dachary.org>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 */
17
18 #include <unistd.h>
19
20 #include "ceph_ver.h"
21 #include "erasure-code/ErasureCodePlugin.h"
22 #include "ErasureCodeExample.h"
23
24 class ErasureCodePluginExample : public ErasureCodePlugin {
25 public:
26 int factory(const std::string &directory,
27 ErasureCodeProfile &profile,
28 ErasureCodeInterfaceRef *erasure_code,
29 ostream *ss) override
30 {
31 *erasure_code = ErasureCodeInterfaceRef(new ErasureCodeExample());
32 (*erasure_code)->init(profile, ss);
33 return 0;
34 }
35 };
36
37 const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
38
39 int __erasure_code_init(char *plugin_name, char *directory)
40 {
41 ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
42 return instance.add(plugin_name, new ErasureCodePluginExample());
43 }