]>
git.proxmox.com Git - ceph.git/blob - ceph/src/common/PluginRegistry.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph distributed storage system
6 * Copyright (C) 2013,2014 Cloudwatt <libre.licensing@cloudwatt.com>
7 * Copyright (C) 2014 Red Hat <contact@redhat.com>
9 * Author: Loic Dachary <loic@dachary.org>
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.
18 #ifndef CEPH_COMMON_PLUGINREGISTRY_H
19 #define CEPH_COMMON_PLUGINREGISTRY_H
21 #include "common/Mutex.h"
26 const char *__ceph_plugin_version();
27 int __ceph_plugin_init(CephContext
*cct
,
28 const std::string
& type
,
29 const std::string
& name
);
39 explicit Plugin(CephContext
*cct
) : library(NULL
), cct(cct
) {}
43 class PluginRegistry
{
49 std::map
<std::string
,std::map
<std::string
,Plugin
*> > plugins
;
51 explicit PluginRegistry(CephContext
*cct
);
54 int add(const std::string
& type
, const std::string
& name
,
56 int remove(const std::string
& type
, const std::string
& name
);
57 Plugin
*get(const std::string
& type
, const std::string
& name
);
58 Plugin
*get_with_load(const std::string
& type
, const std::string
& name
);
60 int load(const std::string
& type
,
61 const std::string
& name
);
63 int preload(const std::string
& type
);