mirror of
https://github.com/ceph/ceph
synced 2024-12-28 06:23:08 +00:00
crimson/os/seastore: minor cleanups
* pass string by reference. more consistent this way. * set a bl using list::append(), simpler this way. Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
parent
8b7542d27f
commit
89d9b739e8
@ -38,17 +38,13 @@ namespace crimson::os::seastore {
|
||||
class FileMDStore final : public SeaStore::MDStore {
|
||||
std::string root;
|
||||
public:
|
||||
FileMDStore(std::string root) : root(root) {}
|
||||
FileMDStore(const std::string& root) : root(root) {}
|
||||
|
||||
write_meta_ret write_meta(
|
||||
const std::string& key, const std::string& value) final {
|
||||
std::string path = fmt::format("{}/{}", root, key);
|
||||
std::string fvalue = value;
|
||||
fvalue += "\n";
|
||||
ceph::bufferptr bp(fvalue.length());
|
||||
ceph::bufferlist bl;
|
||||
bp.copy_in(0, fvalue.length(), fvalue.c_str());
|
||||
bl.push_back(bp);
|
||||
bl.append(value + "\n");
|
||||
return crimson::write_file(std::move(bl), path);
|
||||
}
|
||||
|
||||
@ -73,7 +69,7 @@ public:
|
||||
};
|
||||
|
||||
SeaStore::SeaStore(
|
||||
std::string root,
|
||||
const std::string& root,
|
||||
MDStoreRef mdstore,
|
||||
SegmentManagerRef sm,
|
||||
TransactionManagerRef tm,
|
||||
@ -90,7 +86,7 @@ SeaStore::SeaStore(
|
||||
}
|
||||
|
||||
SeaStore::SeaStore(
|
||||
std::string root,
|
||||
const std::string& root,
|
||||
SegmentManagerRef sm,
|
||||
TransactionManagerRef tm,
|
||||
CollectionManagerRef cm,
|
||||
|
@ -62,14 +62,14 @@ public:
|
||||
using MDStoreRef = std::unique_ptr<MDStore>;
|
||||
|
||||
SeaStore(
|
||||
std::string root,
|
||||
const std::string& root,
|
||||
MDStoreRef mdstore,
|
||||
SegmentManagerRef sm,
|
||||
TransactionManagerRef tm,
|
||||
CollectionManagerRef cm,
|
||||
OnodeManagerRef om);
|
||||
SeaStore(
|
||||
std::string root,
|
||||
const std::string& root,
|
||||
SegmentManagerRef sm,
|
||||
TransactionManagerRef tm,
|
||||
CollectionManagerRef cm,
|
||||
|
Loading…
Reference in New Issue
Block a user