mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-07-03 14:14:11 +00:00
Implement delete tag by id.
This commit is contained in:
parent
3d7632ef2c
commit
7451b8dc5d
1 changed files with 20 additions and 15 deletions
|
@ -37,9 +37,8 @@ namespace dindb {
|
||||||
assert(retval.size() == parRegexes.size());
|
assert(retval.size() == parRegexes.size());
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
} //unnamed namespace
|
|
||||||
|
|
||||||
void tag_files (redis::Command& parRedis, redis::Script& parTagIfInSet, const std::vector<uint64_t>& parFiles, const std::vector<boost::string_ref>& parTags, GroupIDType parSet) {
|
void run_script (redis::Command& parRedis, redis::Script& parScript, const std::vector<uint64_t>& parFiles, const std::vector<boost::string_ref>& parTags, GroupIDType parSet) {
|
||||||
using dinhelp::lexical_cast;
|
using dinhelp::lexical_cast;
|
||||||
|
|
||||||
auto batch = parRedis.make_batch();
|
auto batch = parRedis.make_batch();
|
||||||
|
@ -50,12 +49,17 @@ namespace dindb {
|
||||||
oss << PROGRAM_NAME ":tag:" << tag;
|
oss << PROGRAM_NAME ":tag:" << tag;
|
||||||
const std::string tag_key = oss.str();
|
const std::string tag_key = oss.str();
|
||||||
const std::string file_key = PROGRAM_NAME ":file:" + lexical_cast<std::string>(file_id);
|
const std::string file_key = PROGRAM_NAME ":file:" + lexical_cast<std::string>(file_id);
|
||||||
parTagIfInSet.run(batch, std::make_tuple(tag_key, file_key), std::make_tuple(set_key));
|
parScript.run(batch, std::make_tuple(tag_key, file_key), std::make_tuple(set_key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
batch.throw_if_failed();
|
batch.throw_if_failed();
|
||||||
}
|
}
|
||||||
|
} //unnamed namespace
|
||||||
|
|
||||||
|
void tag_files (redis::Command& parRedis, redis::Script& parTagIfInSet, const std::vector<uint64_t>& parFiles, const std::vector<boost::string_ref>& parTags, GroupIDType parSet) {
|
||||||
|
run_script(parRedis, parTagIfInSet, parFiles, parTags, parSet);
|
||||||
|
}
|
||||||
|
|
||||||
void tag_files (redis::Command& parRedis, redis::Script& parTagIfInSet, const std::vector<std::string>& parRegexes, const std::vector<boost::string_ref>& parTags, GroupIDType parSet) {
|
void tag_files (redis::Command& parRedis, redis::Script& parTagIfInSet, const std::vector<std::string>& parRegexes, const std::vector<boost::string_ref>& parTags, GroupIDType parSet) {
|
||||||
using dinhelp::lexical_cast;
|
using dinhelp::lexical_cast;
|
||||||
|
@ -83,6 +87,7 @@ namespace dindb {
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_tags (redis::Command& parRedis, redis::Script& parDeleIfInSet, const std::vector<uint64_t>& parFiles, const std::vector<boost::string_ref>& parTags, GroupIDType parSet) {
|
void delete_tags (redis::Command& parRedis, redis::Script& parDeleIfInSet, const std::vector<uint64_t>& parFiles, const std::vector<boost::string_ref>& parTags, GroupIDType parSet) {
|
||||||
|
run_script(parRedis, parDeleIfInSet, parFiles, parTags, parSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_tags (redis::Command& parRedis, redis::Script& parDeleIfInSet, const std::vector<std::string>& parRegexes, const std::vector<boost::string_ref>& parTags, GroupIDType parSet) {
|
void delete_tags (redis::Command& parRedis, redis::Script& parDeleIfInSet, const std::vector<std::string>& parRegexes, const std::vector<boost::string_ref>& parTags, GroupIDType parSet) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue