|
SWC-DB
v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
|
Go to the documentation of this file.
13 namespace SWC {
namespace Utils {
namespace shell {
17 :
Interface(
"\033[32mSWC-DB(\033[36mmngr\033[32m)\033[33m> \033[00m",
18 "/tmp/.swc-cli-manager-history",
20 clients(client::Clients::make(
21 *Env::Config::settings(),
22 Comm::IoContext::make(
"Mngr", 8),
30 {
"report cluster-status state by error",
32 [ptr=
this](std::string& cmd){
return ptr->cluster_status(cmd);},
33 "(?i)^(cluster)(\\s|$)"
37 {
"report managers status by mngr-endpoint, of Schema-Role or by All",
38 "status [Schemas(default) | ALL | endpoint=HOST/IP(|PORT)];"},
39 [ptr=
this](std::string& cmd){
return ptr->managers_status(cmd);},
40 "(?i)^(report|status)(\\s|$)"
44 {
"report column status with ranges status",
45 "column-status [cid=CID | name=NAME];"},
46 [ptr=
this](std::string& cmd){
return ptr->column_status(cmd);},
47 "(?i)^(report-column|column-status)"
51 {
"report rangers status by Manager of column or Rangers-Role",
52 "rangers-status [without | cid=CID | name=NAME];"},
53 [ptr=
this](std::string& cmd){
return ptr->rangers_status(cmd);},
54 "(?i)^(report-rangers|rangers-status)"
65 auto groups =
clients->managers.groups->get_groups();
66 for(
auto& g : groups) {
67 auto tmp = g->get_hosts();
72 message.append(
"Empty swc.mngr.host config\n");
73 return error(message);
77 for(
auto& endpoints : hosts) {
83 const int&
error) noexcept {
94 return error(message);
105 size_t at = cmd.find_first_of(
" ");
106 cmd = cmd.substr(at+1);
115 return error(message);
117 std::string host_or_ips;
118 reader.
read(host_or_ips,
" |");
120 return error(message);
121 if(host_or_ips.empty())
122 return error(
"Missing Endpoint");
126 bool was_set =
false;
130 return error(message);
145 port, ips, host, {}, false
149 return error(
"Missing Endpoint");
152 auto groups =
clients->managers.groups->get_groups();
153 for(
auto& g : groups) {
154 auto tmp = g->get_hosts();
163 for(
auto& endpoints : hosts) {
167 [endpoints, await=&res]
172 for(
auto& p : endpoints)
182 await->acknowledge();
194 size_t at = cmd.find_first_of(
" ");
195 cmd = cmd.substr(at+1);
203 bool was_set =
false;
207 return error(message);
212 return error(message);
214 std::string col_name;
215 reader.
read(col_name,
" ");
217 return error(
"Missing Column Name");
221 return error(message);
226 return error(message);
241 await->acknowledge();
248 message.append(
"\n");
249 return error(message);
257 size_t at = cmd.find_first_of(
" ");
258 cmd = cmd.substr(at+1);
266 bool was_set =
false;
270 return error(message);
275 return error(message);
277 std::string col_name;
278 reader.
read(col_name,
" ");
280 return error(
"Missing Column Name");
284 return error(message);
300 await->acknowledge();
307 message.append(
"\n");
308 return error(message);
void add_option(const char *a_name, Core::Vector< std::string > &&a_desc, OptCall_t &&a_call, const char *a_re)
static constexpr const cid_t NO_CID
void expect_token(const char *token, uint8_t token_len, bool &found)
bool cluster_status(std::string &)
void read_uint16_t(uint16_t &value, bool &was_set)
const char * get_text(const int err) noexcept
static SWC::Config::Settings::Ptr & settings()
asio::ip::tcp::endpoint EndPoint
void read_uint64_t(uint64_t &value, bool &was_set, const char *stop=nullptr)
bool error(const std::string &message)
bool column_status(std::string &cmd)
constexpr SWC_CAN_INLINE bool empty() const noexcept
DB::Schema::Ptr get_schema(const Clients::Ptr &clients, const std::string &col)
constexpr SWC_CAN_INLINE reference back() noexcept
SWC_CAN_INLINE void wait()
void read(std::string &buf, const char *stop=nullptr, bool keep_escape=false)
The SWC-DB C++ namespace 'SWC'.
client::Clients::Ptr clients
bool found_token(const char *token, uint8_t token_len)
bool rangers_status(std::string &cmd)
static SWC_CAN_INLINE void request(const SWC::client::Clients::Ptr &clients, const EndPoints &endpoints, Cb_t &&cb, const uint32_t timeout=10000)
void display(std::ostream &out, const std::string &offset="") const
static SWC_CAN_INLINE void request(const SWC::client::Clients::Ptr &clients, cid_t cid, Cb_t &&cb, const uint32_t timeout=10000)
bool is_ipv4_address(const std::string &str) noexcept
constexpr SWC_CAN_INLINE const_iterator cend() const noexcept
SWC_CAN_INLINE void reset() noexcept
bool managers_status(std::string &cmd)
std::shared_ptr< ConnQueueReqBase > Ptr
bool is_ipv6_address(const std::string &str) noexcept
EndPoints get_endpoints(uint16_t defaul_port, const Config::Strings &addrs, const std::string &host, const Networks &nets, bool srv=false)
SWC_CAN_INLINE void push_back(ArgsT &&... args)
constexpr SWC_CAN_INLINE const_iterator cbegin() const noexcept
SWC_CAN_INLINE reference emplace_back(ArgsT &&... args)
SWC_CAN_INLINE iterator insert(size_type offset, ArgsT &&... args)