Converts host specification pattern to list of host names. More...
#include <HostSpecification.h>
Public Member Functions | |
HostSpecification (const std::string &spec) | |
Constructor. More... | |
operator std::vector< std::string > () | |
Expands host specification pattern to list of hostnames. More... | |
Private Attributes | |
const std::string | m_spec |
Host specification pattern. More... | |
Converts host specification pattern to list of host names.
Hostnames in a cluster are typically named using a common prefix followed by a number. To facilitate the specification of a large number of hosts, this class introduces a concise host pattern syntax and provides a function to convert a pattern into a list of hostnames. The host pattern syntax can include numeric ranges such as host[00-15]
and supports set union '+' and set difference '-' operators (left associative). Host sets can also be grouped using parenthesis. The ',' character is equivalent to the '+' character, so a comma-separated list of host names is a valid host specification pattern as well. The following examples illustrate the host specification pattern syntax:
Pattern | Expansion |
---|---|
host[09-10].hypertable.com | host09.hypertable.com host10.hypertable.com |
host[9-10].hypertable.com | host9.hypertable.com host10.hypertable.com |
host[01-02] host03 | host01 host02 host03 |
(host[01-03] - host02) + host[04-05] | host01 host03 host04 host05 |
host01, host02, host03 | host01 host02 host03 |
Definition at line 85 of file HostSpecification.h.
|
inline |
Constructor.
spec | Host specification pattern |
Definition at line 91 of file HostSpecification.h.
Hypertable::HostSpecification::operator std::vector< std::string > | ( | ) |
Expands host specification pattern to list of hostnames.
The list returned by this function is sorted by hostname. Hostnames that match a specific pattern are sorted numerically by their numeric component.
Exception | with code set to Error::BAD_FORMAT on bad input |
|
private |
Host specification pattern.
Definition at line 103 of file HostSpecification.h.