]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
Change CrushWrapper::crush to private 2416/head
authorXiaoxi Chen <xiaoxi.chen@intel.com>
Fri, 5 Sep 2014 02:56:36 +0000 (10:56 +0800)
committerXiaoxi Chen <xiaoxi.chen@intel.com>
Wed, 10 Sep 2014 01:08:22 +0000 (09:08 +0800)
commitd734600f9251b52f525faa35441e2b5dd660161b
tree6c1f6fe4d8af6028ff5592d918084160857d86dd
parente11f0617b1a8a8edaeddddd75c09f7131b5242e9
Change CrushWrapper::crush to private

Currently in CrushWrapper, the member "struct crush_map *crush"  is a public member,
so people can break the encapsulation and manipulate directly to the crush structure.

This is not a good practice for encapsulation and will lead to inconsistent if code
mix use the CrushWrapper API and crush C API.A simple example could be:
1.some code use crush_add_rule(C-API) to add a rule, which will not set the have_rmap flag to false in CrushWrapper
2.another code using CrushWrapper trying to look up the newly added rule by name will get a -ENOENT.

This patch move CrushWrapper::crush to private, together with three reverse map(type_rmap, name_rmap, rule_name_rmap)
and also change codes accessing the CrushWrapper::crush to make it compile.

Signed-off-by: Xiaoxi Chen <xiaoxi.chen@intel.com>
src/crush/CrushWrapper.h
src/test/crush/indep.cc
src/tools/crushtool.cc