1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2017 Red Hat Ltd
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
16 #ifndef FS_COMMANDS_H_
17 #define FS_COMMANDS_H_
21 #include "osd/OSDMap.h"
22 #include "mds/FSMap.h"
27 class FileSystemCommandHandler
33 * Parse true|yes|1 style boolean string from `bool_str`
34 * `result` must be non-null.
35 * `ss` will be populated with error message on error.
37 * @return 0 on success, else -EINVAL
40 const std::string &bool_str,
45 * Return 0 if the pool is suitable for use with CephFS, or
46 * in case of errors return a negative error code, and populate
47 * the passed stringstream with an explanation.
49 * @param metadata whether the pool will be for metadata (stricter checks)
53 const int64_t pool_id,
56 std::stringstream *ss) const;
58 virtual std::string const &get_prefix() {return prefix;}
61 FileSystemCommandHandler(const std::string &prefix_)
65 virtual ~FileSystemCommandHandler()
68 bool can_handle(std::string const &prefix_)
70 return get_prefix() == prefix_;
73 static std::list<std::shared_ptr<FileSystemCommandHandler> > load(Paxos *paxos);
75 virtual bool batched_propose() {
83 map<string, cmd_vartype> &cmdmap,
84 std::stringstream &ss) = 0;