Lines Matching refs:id
614 static void PrintHashForCorruptedStashedBlocks(const std::string& id, in PrintHashForCorruptedStashedBlocks() argument
617 LOG(INFO) << "printing hash in hex for stash_id: " << id; in PrintHashForCorruptedStashedBlocks()
632 static void PrintHashForMissingStashedBlocks(const std::string& id, int fd) { in PrintHashForMissingStashedBlocks() argument
633 if (stash_map.find(id) == stash_map.end()) { in PrintHashForMissingStashedBlocks()
634 LOG(ERROR) << "No stash saved for id: " << id; in PrintHashForMissingStashedBlocks()
638 LOG(INFO) << "print hash in hex for source blocks in missing stash: " << id; in PrintHashForMissingStashedBlocks()
639 const RangeSet& src = stash_map[id]; in PrintHashForMissingStashedBlocks()
642 LOG(ERROR) << "failed to read source blocks for stash: " << id; in PrintHashForMissingStashedBlocks()
645 PrintHashForCorruptedStashedBlocks(id, buffer, src); in PrintHashForMissingStashedBlocks()
668 static std::string GetStashFileName(const std::string& base, const std::string& id, in GetStashFileName() argument
674 if (id.empty() && postfix.empty()) { in GetStashFileName()
677 return filename + "/" + id + postfix; in GetStashFileName()
730 static int LoadStash(const CommandParameters& params, const std::string& id, bool verify, in LoadStash() argument
735 if (stash_map.find(id) != stash_map.end()) { in LoadStash()
736 const RangeSet& src = stash_map[id]; in LoadStash()
743 if (VerifyBlocks(id, *buffer, src.blocks(), true) != 0) { in LoadStash()
746 PrintHashForCorruptedStashedBlocks(id, *buffer, src); in LoadStash()
754 std::string fn = GetStashFileName(params.stashbase, id, ""); in LoadStash()
760 PrintHashForMissingStashedBlocks(id, params.fd); in LoadStash()
788 if (verify && VerifyBlocks(id, *buffer, blocks, true) != 0) { in LoadStash()
790 if (stash_map.find(id) == stash_map.end()) { in LoadStash()
791 LOG(ERROR) << "failed to find source blocks number for stash " << id in LoadStash()
794 const RangeSet& src = stash_map[id]; in LoadStash()
795 PrintHashForCorruptedStashedBlocks(id, *buffer, src); in LoadStash()
804 static int WriteStash(const std::string& base, const std::string& id, int blocks, in WriteStash() argument
815 std::string fn = GetStashFileName(base, id, ".partial"); in WriteStash()
816 std::string cn = GetStashFileName(base, id, ""); in WriteStash()
946 static int FreeStash(const std::string& base, const std::string& id) { in FreeStash() argument
947 if (base.empty() || id.empty()) { in FreeStash()
951 DeleteFile(GetStashFileName(base, id, "")); in FreeStash()
1215 const std::string& id = params.tokens[params.cpos++]; in PerformCommandStash() local
1216 if (LoadStash(params, id, true, ¶ms.buffer, false) == 0) { in PerformCommandStash()
1230 stash_map[id] = src; in PerformCommandStash()
1232 if (VerifyBlocks(id, params.buffer, blocks, true) != 0) { in PerformCommandStash()
1236 LOG(ERROR) << "failed to load source blocks for stash " << id; in PerformCommandStash()
1245 LOG(INFO) << "stashing " << blocks << " blocks to " << id; in PerformCommandStash()
1246 int result = WriteStash(params.stashbase, id, blocks, params.buffer, false, nullptr); in PerformCommandStash()
1260 const std::string& id = params.tokens[params.cpos++]; in PerformCommandFree() local
1261 stash_map.erase(id); in PerformCommandFree()
1264 return FreeStash(params.stashbase, id); in PerformCommandFree()