| 424 | |
| 425 | |
| 426 | Result<std::set<string>> ZooKeeperStorageProcess::doNames() |
| 427 | { |
| 428 | // Get all children to determine current memberships. |
| 429 | vector<string> results; |
| 430 | |
| 431 | int code = zk->getChildren(znode, false, &results); |
| 432 | |
| 433 | if (code == ZINVALIDSTATE || (code != ZOK && zk->retryable(code))) { |
| 434 | CHECK(zk->getState() != ZOO_AUTH_FAILED_STATE); |
| 435 | return None(); // Try again later. |
| 436 | } else if (code != ZOK) { |
| 437 | return Error( |
| 438 | "Failed to get children of '" + znode + |
| 439 | "' in ZooKeeper: " + zk->message(code)); |
| 440 | } |
| 441 | |
| 442 | // TODO(benh): It might make sense to "mangle" the names so that we |
| 443 | // can determine when a znode has incorrectly been added that |
| 444 | // actually doesn't store an Entry. |
| 445 | return std::set<string>(results.begin(), results.end()); |
| 446 | } |
| 447 | |
| 448 | |
| 449 | Result<Option<Entry>> ZooKeeperStorageProcess::doGet(const string& name) |