| 929 | // ===================================== |
| 930 | |
| 931 | int FindSpan(uint64_t trace_id, uint64_t span_id, RpczSpan* response) { |
| 932 | butil::intrusive_ptr<SpanDB> db; |
| 933 | if (GetSpanDB(&db) != 0) { |
| 934 | return -1; |
| 935 | } |
| 936 | uint32_t key_data[4]; |
| 937 | ToBigEndian(trace_id, key_data); |
| 938 | ToBigEndian(span_id, key_data + 2); |
| 939 | leveldb::Slice key((char*)key_data, sizeof(key_data)); |
| 940 | std::string value; |
| 941 | leveldb::Status st = db->id_db->Get(leveldb::ReadOptions(), key, &value); |
| 942 | if (!st.ok()) { |
| 943 | return -1; |
| 944 | } |
| 945 | if (!response->ParseFromString(value)) { |
| 946 | LOG(ERROR) << "Fail to parse from the value"; |
| 947 | return -1; |
| 948 | } |
| 949 | return 0; |
| 950 | } |
| 951 | |
| 952 | void FindSpans(uint64_t trace_id, std::deque<RpczSpan>* out) { |
| 953 | out->clear(); |
no test coverage detected