Apache Mesos
|
Functions | |
bool | isStrictSubroleOf (const std::string &left, const std::string &right) |
Returns true iff left is a strict subrole of right . More... | |
Try< std::vector< std::string > > | parse (const std::string &text) |
Parses Roles from text in the form "role1,role2,role3". More... | |
std::vector< std::string > | ancestors (const std::string &role) |
Returns the ancestor roles for the role. More... | |
Option< Error > | validate (const std::string &role) |
Validates the given role name. More... | |
Option< Error > | validate (const std::vector< std::string > &roles) |
Validates the given list of roles. More... | |
std::vector<std::string> mesos::roles::ancestors | ( | const std::string & | role | ) |
Returns the ancestor roles for the role.
E.g. "a/b/c/d" returns ["a/b/c", "a/b", "a"].
Assumes the provided role is valid.
TODO(bmahler): Use string_view to avoid copying, this requires overloading to ensure that the argument is not an rvalue.
bool mesos::roles::isStrictSubroleOf | ( | const std::string & | left, |
const std::string & | right | ||
) |
Returns true iff left
is a strict subrole of right
.
left
is a strict subrole of right
if left
is not equal to right
, and left
is a descendant of right
in the role hierarchy.
Examples:
foo
is not a strict subrole of foo
.foo/bar
is a strict subrole of foo
.foobar
is not a strict subrole of foo
.
|
inline |
Parses Roles from text in the form "role1,role2,role3".
text | String to be parsed |
Parses Roles from text in the form "role1,role2,role3".