static */
| 84 | |
| 85 | /* static */ |
| 86 | Status Rendezvous::ParseKey(StringPiece key, ParsedKey* out) { |
| 87 | if (key.data() == out->buf_.data()) { |
| 88 | // Caller used our buf_ string directly, so we don't need to copy. (The |
| 89 | // SendOp and RecvOp implementations do this, for example). |
| 90 | DCHECK_EQ(key.size(), out->buf_.size()); |
| 91 | } else { |
| 92 | // Make a copy that our StringPieces can point at a copy that will persist |
| 93 | // for the lifetime of the ParsedKey object. |
| 94 | out->buf_.assign(key.data(), key.size()); |
| 95 | } |
| 96 | StringPiece s(out->buf_); |
| 97 | StringPiece parts[5]; |
| 98 | for (int i = 0; i < 5; i++) { |
| 99 | parts[i] = ConsumeNextPart(&s, ';'); |
| 100 | } |
| 101 | if (s.empty() && // Consumed the whole string |
| 102 | !parts[4].empty() && // Exactly five parts |
| 103 | DeviceNameUtils::ParseFullName(parts[0], &out->src) && |
| 104 | strings::HexStringToUint64(parts[1], &out->src_incarnation) && |
| 105 | DeviceNameUtils::ParseFullName(parts[2], &out->dst) && |
| 106 | !parts[3].empty()) { |
| 107 | out->src_device = StringPiece(parts[0].data(), parts[0].size()); |
| 108 | out->dst_device = StringPiece(parts[2].data(), parts[2].size()); |
| 109 | out->edge_name = StringPiece(parts[3].data(), parts[3].size()); |
| 110 | return Status::OK(); |
| 111 | } |
| 112 | return errors::InvalidArgument("Invalid rendezvous key: ", key); |
| 113 | } |
| 114 | |
| 115 | Rendezvous::~Rendezvous() {} |
| 116 |
nothing calls this directly
no test coverage detected