mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-15 18:32:18 +08:00
Merge pull request #6722 from sfc-gh-satherton/fix-backup-backward-compatibility
Fixed Codec<Reference<IBackupContainer>> backward compatibility bug from #6705
This commit is contained in:
commit
e2c66de28f
@ -727,30 +727,36 @@ template <>
|
|||||||
inline Tuple Codec<Reference<IBackupContainer>>::pack(Reference<IBackupContainer> const& bc) {
|
inline Tuple Codec<Reference<IBackupContainer>>::pack(Reference<IBackupContainer> const& bc) {
|
||||||
Tuple tuple;
|
Tuple tuple;
|
||||||
tuple.append(StringRef(bc->getURL()));
|
tuple.append(StringRef(bc->getURL()));
|
||||||
if (bc->getProxy().present()) {
|
|
||||||
tuple.append(StringRef(bc->getProxy().get()));
|
|
||||||
} else {
|
|
||||||
tuple.append(StringRef());
|
|
||||||
}
|
|
||||||
if (bc->getEncryptionKeyFileName().present()) {
|
if (bc->getEncryptionKeyFileName().present()) {
|
||||||
tuple.append(bc->getEncryptionKeyFileName().get());
|
tuple.append(bc->getEncryptionKeyFileName().get());
|
||||||
} else {
|
} else {
|
||||||
tuple.append(StringRef());
|
tuple.append(StringRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bc->getProxy().present()) {
|
||||||
|
tuple.append(StringRef(bc->getProxy().get()));
|
||||||
|
} else {
|
||||||
|
tuple.append(StringRef());
|
||||||
|
}
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
inline Reference<IBackupContainer> Codec<Reference<IBackupContainer>>::unpack(Tuple const& val) {
|
inline Reference<IBackupContainer> Codec<Reference<IBackupContainer>>::unpack(Tuple const& val) {
|
||||||
ASSERT(val.size() == 3);
|
ASSERT(val.size() >= 1);
|
||||||
auto url = val.getString(0).toString();
|
auto url = val.getString(0).toString();
|
||||||
Optional<std::string> proxy;
|
|
||||||
if (!val.getString(1).empty()) {
|
|
||||||
proxy = val.getString(1).toString();
|
|
||||||
}
|
|
||||||
Optional<std::string> encryptionKeyFileName;
|
Optional<std::string> encryptionKeyFileName;
|
||||||
if (!val.getString(2).empty()) {
|
if (val.size() > 1 && !val.getString(1).empty()) {
|
||||||
encryptionKeyFileName = val.getString(2).toString();
|
encryptionKeyFileName = val.getString(1).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Optional<std::string> proxy;
|
||||||
|
if (val.size() > 2 && !val.getString(2).empty()) {
|
||||||
|
proxy = val.getString(2).toString();
|
||||||
|
}
|
||||||
|
|
||||||
return IBackupContainer::openContainer(url, proxy, encryptionKeyFileName);
|
return IBackupContainer::openContainer(url, proxy, encryptionKeyFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user