remove unused repo cache functions

This commit is contained in:
2023-07-15 22:26:15 +02:00
parent dba5f06c10
commit f517b0deab
4 changed files with 1 additions and 35 deletions

View File

@@ -95,7 +95,6 @@ void CommandRun::run(Context ctx) {
File repoFile = Serialize::deserialize<File>(ctx.repo->getObject(Object::ObjectType::File, relPath)); File repoFile = Serialize::deserialize<File>(ctx.repo->getObject(Object::ObjectType::File, relPath));
if (!changeDetector.check({repoFile, ctx.repo}, {p, from})) { if (!changeDetector.check({repoFile, ctx.repo}, {p, from})) {
addFile(repoFile.id); addFile(repoFile.id);
ctx.repo->addToCache(repoFile);
progress.print("Skipped: " + relPath, 1); progress.print("Skipped: " + relPath, 1);
runnerStats.filesSkipped++; runnerStats.filesSkipped++;
return; return;

View File

@@ -43,9 +43,6 @@ public:
Object::idType getObjectId(Object::ObjectType type, const std::string &key) const override; Object::idType getObjectId(Object::ObjectType type, const std::string &key) const override;
std::vector<std::pair<std::string, Object::idType>> getObjects(Object::ObjectType type) const override; std::vector<std::pair<std::string, Object::idType>> getObjects(Object::ObjectType type) const override;
bool clearCache(Object::ObjectType type) override;
bool addToCache(const Object &obj) override;
bool exists(Object::ObjectType type, const std::string &key) const override; bool exists(Object::ObjectType type, const std::string &key) const override;
Object::idType getId() override; Object::idType getId() override;

View File

@@ -86,17 +86,6 @@ public:
/// \throws Exception on any error /// \throws Exception on any error
virtual bool exists(Object::ObjectType type, const std::string &key) const = 0; virtual bool exists(Object::ObjectType type, const std::string &key) const = 0;
/// Erases all the cache entries of object type \p type
/// \param type Type of the objects
/// \return True
virtual bool clearCache(Object::ObjectType type) = 0;
/// Adds the object to the cache, but doesn't change it on disk otherwise
/// \param obj Constant reference to the object
/// \return True
/// \throws Exception on any error, or if the object doesn't exist
virtual bool addToCache(const Object &obj) = 0;
/// Returns the next available object id /// Returns the next available object id
virtual Object::idType getId() = 0; virtual Object::idType getId() = 0;

View File

@@ -225,22 +225,3 @@ void FileRepository::OffsetEntry::serialize(std::vector<char> &out) const {
FileRepository::OffsetEntry::OffsetEntry(unsigned long long int fileId, unsigned long long int offset, unsigned long long int length) FileRepository::OffsetEntry::OffsetEntry(unsigned long long int fileId, unsigned long long int offset, unsigned long long int length)
: fileId(fileId), offset(offset), length(length) {} : fileId(fileId), offset(offset), length(length) {}
bool FileRepository::clearCache(Object::ObjectType type) {
keyIndex[type] = {};
return true;
}
bool FileRepository::addToCache(const Object &obj) {
{
std::unique_lock lock(repoLock);
if (offsetIndex.count(obj.id) == 0)
throw Exception("Object with id " + std::to_string(obj.id) + " doesn't exist!");
}
{
std::lock_guard lock(repoLock);
keyIndex[obj.type][obj.getKey()] = obj.id;
}
return true;
}