mirror of
https://github.com/usatiuk/backup.git
synced 2025-10-27 01:37:49 +01:00
getRefs on objects
This commit is contained in:
@@ -17,3 +17,7 @@ void Object::serialize(std::vector<char> &out) const {
|
||||
}
|
||||
|
||||
Object::~Object() = default;
|
||||
|
||||
static std::vector<Object::idType> emptyRef{};
|
||||
|
||||
const std::vector<Object::idType> &Object::getRefs() const { return emptyRef; }
|
||||
|
||||
@@ -28,3 +28,5 @@ void Archive::serialize(std::vector<char> &out) const {
|
||||
}
|
||||
|
||||
std::string Archive::getKey() const { return name; }
|
||||
|
||||
const std::vector<Object::idType> &Archive::getRefs() const { return files; }
|
||||
|
||||
@@ -83,3 +83,16 @@ unsigned long long File::getFileSize(const std::filesystem::path &p) {
|
||||
else
|
||||
return getFileContents(p).size();
|
||||
}
|
||||
|
||||
void File::makeChunksList() const {
|
||||
if (chunksList) return;
|
||||
chunksList.emplace();
|
||||
|
||||
chunksList->reserve(chunks.size());
|
||||
for (auto const &c: chunks) chunksList->emplace_back(c.second);
|
||||
}
|
||||
|
||||
const std::vector<Object::idType> &File::getRefs() const {
|
||||
if (!chunksList) makeChunksList();
|
||||
return *chunksList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user