Lines Matching refs:id
619 static void PrintHashForCorruptedStashedBlocks(const std::string& id, in PrintHashForCorruptedStashedBlocks() argument
622 LOG(INFO) << "printing hash in hex for stash_id: " << id; in PrintHashForCorruptedStashedBlocks()
637 static void PrintHashForMissingStashedBlocks(const std::string& id, int fd) { in PrintHashForMissingStashedBlocks() argument
638 if (stash_map.find(id) == stash_map.end()) { in PrintHashForMissingStashedBlocks()
639 LOG(ERROR) << "No stash saved for id: " << id; in PrintHashForMissingStashedBlocks()
643 LOG(INFO) << "print hash in hex for source blocks in missing stash: " << id; in PrintHashForMissingStashedBlocks()
644 const RangeSet& src = stash_map[id]; in PrintHashForMissingStashedBlocks()
647 LOG(ERROR) << "failed to read source blocks for stash: " << id; in PrintHashForMissingStashedBlocks()
650 PrintHashForCorruptedStashedBlocks(id, buffer, src); in PrintHashForMissingStashedBlocks()
673 static std::string GetStashFileName(const std::string& base, const std::string& id, in GetStashFileName() argument
679 if (id.empty() && postfix.empty()) { in GetStashFileName()
682 return filename + "/" + id + postfix; in GetStashFileName()
735 static int LoadStash(const CommandParameters& params, const std::string& id, bool verify, in LoadStash() argument
740 if (stash_map.find(id) != stash_map.end()) { in LoadStash()
741 const RangeSet& src = stash_map[id]; in LoadStash()
748 if (VerifyBlocks(id, *buffer, src.blocks(), true) != 0) { in LoadStash()
751 PrintHashForCorruptedStashedBlocks(id, *buffer, src); in LoadStash()
759 std::string fn = GetStashFileName(params.stashbase, id, ""); in LoadStash()
765 PrintHashForMissingStashedBlocks(id, params.fd); in LoadStash()
793 if (verify && VerifyBlocks(id, *buffer, blocks, true) != 0) { in LoadStash()
795 if (stash_map.find(id) == stash_map.end()) { in LoadStash()
796 LOG(ERROR) << "failed to find source blocks number for stash " << id in LoadStash()
799 const RangeSet& src = stash_map[id]; in LoadStash()
800 PrintHashForCorruptedStashedBlocks(id, *buffer, src); in LoadStash()
809 static int WriteStash(const std::string& base, const std::string& id, int blocks, in WriteStash() argument
820 std::string fn = GetStashFileName(base, id, ".partial"); in WriteStash()
821 std::string cn = GetStashFileName(base, id, ""); in WriteStash()
951 static int FreeStash(const std::string& base, const std::string& id) { in FreeStash() argument
952 if (base.empty() || id.empty()) { in FreeStash()
956 DeleteFile(GetStashFileName(base, id, "")); in FreeStash()
1220 const std::string& id = params.tokens[params.cpos++]; in PerformCommandStash() local
1221 if (LoadStash(params, id, true, ¶ms.buffer, false) == 0) { in PerformCommandStash()
1235 stash_map[id] = src; in PerformCommandStash()
1237 if (VerifyBlocks(id, params.buffer, blocks, true) != 0) { in PerformCommandStash()
1241 LOG(ERROR) << "failed to load source blocks for stash " << id; in PerformCommandStash()
1250 LOG(INFO) << "stashing " << blocks << " blocks to " << id; in PerformCommandStash()
1251 int result = WriteStash(params.stashbase, id, blocks, params.buffer, false, nullptr); in PerformCommandStash()
1265 const std::string& id = params.tokens[params.cpos++]; in PerformCommandFree() local
1266 stash_map.erase(id); in PerformCommandFree()
1269 return FreeStash(params.stashbase, id); in PerformCommandFree()