]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: add crush ruleset creation API
authorLoic Dachary <loic@dachary.org>
Sun, 26 Jan 2014 17:54:37 +0000 (18:54 +0100)
committerLoic Dachary <loic@dachary.org>
Tue, 4 Feb 2014 07:06:25 +0000 (08:06 +0100)
Because only the erasure code plugin knows enough to create a ruleset
that is best suited for a given set of parameters.

Reviewed-By: Christophe Courtaut <christophe.courtaut@gmail.com>
Signed-off-by: Loic Dachary <loic@dachary.org>
src/osd/ErasureCodeInterface.h

index 9a44be71bb88f7f2ef28ac18248a35323d395bbd..f8e22d1eb531bd397db3a94eccdc2b551fae0608 100644 (file)
 #include "include/memory.h"
 #include "include/buffer.h"
 
+class CrushWrapper;
+
 using namespace std;
 
 namespace ceph {
@@ -153,6 +155,24 @@ namespace ceph {
   public:
     virtual ~ErasureCodeInterface() {}
 
+    /**
+     * Create a new ruleset in **crush** under the name **name**,
+     * unless it already exists.
+     *
+     * Return the ruleset number that was created on success. If a
+     * ruleset **name** already exists, return -EEXISTS, otherwise
+     * return a negative value indicating an error with a semantic
+     * defined by the implementation.
+     *
+     * @param [in] name of the ruleset to create
+     * @param [in] crush crushmap in which the ruleset is created
+     * @param [out] ss contains informative messages when an error occurs
+     * @return **0** on success or a negative errno on error.
+     */
+    virtual int create_ruleset(const string &name,
+                              CrushWrapper &crush,
+                              ostream *ss) const = 0;
+
     /**
      * Return the number of chunks created by a call to the **encode**
      * method.