MCPcopy Create free account
hub / github.com/apple/foundationdb / getUserType

Method getUserType

fdbclient/Tuple.cpp:428–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426}
427
428Tuple::UserTypeStr Tuple::getUserType(size_t index) const {
429 // Valid index.
430 if (index >= offsets.size()) {
431 throw invalid_tuple_index();
432 }
433
434 // Valid user type code.
435 ASSERT_LT(offsets[index], data.size());
436 uint8_t code = data[offsets[index]];
437 if (!isUserType(code)) {
438 throw invalid_tuple_data_type();
439 }
440
441 size_t start = offsets[index] + 1;
442
443 Standalone<StringRef> str;
444 VectorRef<uint8_t> staging;
445 staging.append(str.arena(), data.begin() + start, data.size() - start);
446 str.StringRef::operator=(StringRef(staging.begin(), staging.size()));
447
448 return Tuple::UserTypeStr(code, str);
449}
450
451KeyRange Tuple::range(Tuple const& tuple) const {
452 VectorRef<uint8_t> begin;

Callers 1

Tuple.cppFile · 0.80

Calls 4

UserTypeStrClass · 0.85
sizeMethod · 0.45
appendMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected