| 688 | |
| 689 | |
| 690 | Result<Option<string>> GroupProcess::doData( |
| 691 | const Group::Membership& membership) |
| 692 | { |
| 693 | CHECK_EQ(state, READY); |
| 694 | |
| 695 | string path = path::join( |
| 696 | znode, |
| 697 | zkBasename(membership), |
| 698 | os::POSIX_PATH_SEPARATOR); |
| 699 | |
| 700 | LOG(INFO) << "Trying to get '" << path << "' in ZooKeeper"; |
| 701 | |
| 702 | // Get data associated with ephemeral node. |
| 703 | string result; |
| 704 | |
| 705 | int code = zk->get(path, false, &result, nullptr); |
| 706 | |
| 707 | if (code == ZNONODE) { |
| 708 | return Option<string>::none(); |
| 709 | } else if (code == ZINVALIDSTATE || (code != ZOK && zk->retryable(code))) { |
| 710 | CHECK_NE(zk->getState(), ZOO_AUTH_FAILED_STATE); |
| 711 | return None(); // Try again later. |
| 712 | } else if (code != ZOK) { |
| 713 | return Error( |
| 714 | "Failed to get data for ephemeral node '" + path + |
| 715 | "' in ZooKeeper: " + zk->message(code)); |
| 716 | } |
| 717 | |
| 718 | return Some(result); |
| 719 | } |
| 720 | |
| 721 | |
| 722 | Try<bool> GroupProcess::cache() |