|
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[36mrgr\033[32m)\033[33m> \033[00m",
18 "/tmp/.swc-cli-ranger-history",
20 clients(client::Clients::make(
21 *Env::Config::settings(),
22 Comm::IoContext::make(
"Rgr", 8),
30 {
"report Ranger resources",
31 "report-resources endpoint/hostname[|port];"},
32 [ptr=
this](std::string& cmd){
return ptr->report_resources(cmd);},
33 "(?i)^(report-resources)"
37 {
"report loaded column or all and opt. ranges on a Ranger",
38 "report [cid=NUM/column='name'] [ranges] endpoint/hostname[|port];"},
39 [ptr=
this](std::string& cmd){
return ptr->report(cmd);},
51 std::remove_if(host_or_ips.begin(), host_or_ips.end(),
52 [](
unsigned char x){return std::isspace(x);} ),
58 size_t at = host_or_ips.find_first_of(
"|");
59 if(at != std::string::npos) {
60 std::string port_str = host_or_ips.substr(at+1);
61 host_or_ips = host_or_ips.substr(0, at);
63 if((port = std::stoul(port_str)) > UINT16_MAX )
70 message.append(
"Bad value='"+port_str+
"' for port\n");
71 return error(message);
77 message.append(
"Bad value='"+
std::to_string(port)+
"' for port\n");
78 return error(message);
91 if(endpoints.
empty()) {
92 message.append(
"Empty endpoints\n");
98 message.append(e.
what());
106 size_t at = cmd.find_first_of(
" ");
107 std::string host_or_ips = cmd.substr(at+1);
126 await->acknowledge();
133 message.append(
"\n");
134 return error(message);
142 size_t at = cmd.find_first_of(
" ");
143 cmd = cmd.substr(at+1);
151 bool was_set =
false;
155 return error(message);
160 return error(message);
162 std::string col_name;
163 reader.
read(col_name,
" ");
165 return error(
"Missing Column Name");
169 return error(message);
177 std::string host_or_ips(reader.
ptr, reader.
remain);
204 await->acknowledge();
221 await->acknowledge();
239 await->acknowledge();
257 await->acknowledge();
273 message.append(
"\n");
274 return error(message);
void add_option(const char *a_name, Core::Vector< std::string > &&a_desc, OptCall_t &&a_call, const char *a_re)
constexpr SWC_CAN_INLINE int code() const noexcept
static constexpr const cid_t NO_CID
const char * get_text(const int err) noexcept
static SWC::Config::Settings::Ptr & settings()
void read_uint64_t(uint64_t &value, bool &was_set, const char *stop=nullptr)
bool error(const std::string &message)
static void request(const SWC::client::Clients::Ptr &clients, const EndPoints &endpoints, cid_t cid, Cb_t &&cb, const uint32_t timeout=10000)
void display(std::ostream &out, const std::string &offset="") const
void display(std::ostream &out, const std::string &offset="") const
bool read_endpoint(std::string &host_or_ips, Comm::EndPoints &endpoints)
constexpr SWC_CAN_INLINE bool empty() const noexcept
DB::Schema::Ptr get_schema(const Clients::Ptr &clients, const std::string &col)
static SWC_CAN_INLINE void request(const SWC::client::Clients::Ptr &clients, const EndPoints &endpoints, Cb_t &&cb, const uint32_t timeout=10000)
SWC_CAN_INLINE void wait()
void read(std::string &buf, const char *stop=nullptr, bool keep_escape=false)
#define SWC_CURRENT_EXCEPTION(_msg_)
The SWC-DB C++ namespace 'SWC'.
client::Clients::Ptr clients
bool found_token(const char *token, uint8_t token_len)
bool is_ipv4_address(const std::string &str) noexcept
static void request(const SWC::client::Clients::Ptr &clients, const EndPoints &endpoints, Cb_t &&cb, const uint32_t timeout=10000)
void display(std::ostream &out, bool pretty=true, const std::string &offset="") const
SWC_CAN_INLINE void acknowledge() noexcept
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)
SWC_CAN_INLINE std::string to_string(const BitFieldInt< T, SZ > &v)
virtual SWC_CAN_INLINE const char * what() const noexcept override
static SWC_CAN_INLINE void request(const SWC::client::Clients::Ptr &clients, const EndPoints &endpoints, Cb_t &&cb, const uint32_t timeout=10000)
bool report_resources(std::string &cmd)
void display(std::ostream &out, const std::string &offset="") const
bool report(std::string &cmd)