]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mgr: use a struct for DaemonKey
authorKefu Chai <kchai@redhat.com>
Sun, 29 Sep 2019 09:28:28 +0000 (17:28 +0800)
committerPonnuvel Palaniyappan <ponnuvel.palaniyappan@canonical.com>
Fri, 12 Mar 2021 19:20:13 +0000 (19:20 +0000)
commit3f35f5ba448dd2b610fe0e5f7fb546dd8e942750
tree5315463ab4c2b78086546b0ffb1ffc695387ad3a
parent2e95b5d99e0dec516803c8a1b57fbd2c8f45fd63
mgr: use a struct for DaemonKey

instead of using `std::pair<>` for presenting it. there are three
advantages:

1. better names for readability: `type` and `name` are better names
   than `first` and `second`
2. so we can specliaze its behavior by its type: define
   `operator<<` once, and use it everywhere. no need to worry
   about ADL to pickup the generic operator of `operator<< (..., pair<>)`
   anymore. so we can safely use `<< key`, and no need to
   use `<< key.first << '.' << key.second`. kill the printed form of
   `osd,1` once and for all, all of them are now "osd.1".
3. consolidate the print/parse in a single place

Fixes: https://tracker.ceph.com/issues/42079
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 5aac7eba36be99861eb8726872e339ff55360f47)

 Conflicts:
src/mgr/DaemonServer.cc
src/mgr/Mgr.cc
 - convert/edit std::pair to DaemonKey:name-value in a few places
src/mgr/ActivePyModules.cc
src/mgr/CMakeLists.txt
src/mgr/DaemonHealthMetricCollector.cc
src/mgr/DaemonHealthMetricCollector.h
src/mgr/DaemonKey.cc [new file with mode: 0644]
src/mgr/DaemonKey.h [new file with mode: 0644]
src/mgr/DaemonServer.cc
src/mgr/DaemonState.cc
src/mgr/DaemonState.h
src/mgr/Mgr.cc