in src/storage/rdb/rdb.cc [406:457]
StatusOr<RedisObjValue> RDB::loadRdbObject(int type, [[maybe_unused]] const std::string &key) {
if (type == RDBTypeString) {
auto value = GET_OR_RET(LoadStringObject());
return value;
} else if (type == RDBTypeSet || type == RDBTypeSetIntSet || type == RDBTypeSetListPack) {
std::vector<std::string> members;
if (type == RDBTypeSet) {
members = GET_OR_RET(LoadSetObject());
} else if (type == RDBTypeSetListPack) {
members = GET_OR_RET(LoadSetWithListPack());
} else {
members = GET_OR_RET(LoadSetWithIntSet());
}
return members;
} else if (type == RDBTypeZSet || type == RDBTypeZSet2 || type == RDBTypeZSetListPack || type == RDBTypeZSetZipList) {
std::vector<MemberScore> member_scores;
if (type == RDBTypeZSet || type == RDBTypeZSet2) {
member_scores = GET_OR_RET(LoadZSetObject(type));
} else if (type == RDBTypeZSetListPack) {
member_scores = GET_OR_RET(LoadZSetWithListPack());
} else {
member_scores = GET_OR_RET(LoadZSetWithZipList());
}
return member_scores;
} else if (type == RDBTypeHash || type == RDBTypeHashListPack || type == RDBTypeHashZipList ||
type == RDBTypeHashZipMap) {
std::map<std::string, std::string> entries;
if (type == RDBTypeHash) {
entries = GET_OR_RET(LoadHashObject());
} else if (type == RDBTypeHashListPack) {
entries = GET_OR_RET(LoadHashWithListPack());
} else if (type == RDBTypeHashZipList) {
entries = GET_OR_RET(LoadHashWithZipList());
} else {
entries = GET_OR_RET(LoadHashWithZipMap());
}
return entries;
} else if (type == RDBTypeList || type == RDBTypeListZipList || type == RDBTypeListQuickList ||
type == RDBTypeListQuickList2) {
std::vector<std::string> elements;
if (type == RDBTypeList) {
elements = GET_OR_RET(LoadListObject());
} else if (type == RDBTypeListZipList) {
elements = GET_OR_RET(LoadListWithZipList());
} else {
elements = GET_OR_RET(LoadListWithQuickList(type));
}
return elements;
}
return {Status::RedisParseErr, fmt::format("unsupported type: {}", type)};
}