mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2024-11-25 00:53:43 +00:00
Implement find_paths_starting_by().
This commit is contained in:
parent
12c062b939
commit
853fb13495
3 changed files with 18 additions and 2 deletions
|
@ -183,7 +183,8 @@ namespace dindb {
|
|||
"base_file_id", lexical_cast<std::string>(base_file_id),
|
||||
"item_count", lexical_cast<std::string>(parData.size()),
|
||||
"dir_count", lexical_cast<std::string>(std::count_if(parData.begin(), parData.end(), [](const mchlib::FileRecordData& r){return r.is_directory;})),
|
||||
"creation", lexical_cast<std::string>(std::time(nullptr))
|
||||
"creation", lexical_cast<std::string>(std::time(nullptr)),
|
||||
"app_name", parSignature
|
||||
);
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
|
@ -282,7 +283,7 @@ namespace dindb {
|
|||
}
|
||||
|
||||
std::vector<std::string> BackendRedis::find_paths_starting_by (GroupIDType parGroupID, uint16_t parLevel, boost::string_ref parPath) {
|
||||
return std::vector<std::string>();
|
||||
return dindb::find_paths_starting_by(m_redis, parGroupID, parLevel, parPath);
|
||||
}
|
||||
} //namespace dindb
|
||||
|
||||
|
|
|
@ -317,4 +317,15 @@ namespace dindb {
|
|||
}
|
||||
return retval;
|
||||
};
|
||||
|
||||
std::vector<std::string> find_paths_starting_by (redis::IncRedis& parRedis, GroupIDType parGroupID, uint16_t parLevel, boost::string_ref parPath) {
|
||||
using boost::adaptors::transformed;
|
||||
using dinhelp::MaxSizedArray;
|
||||
|
||||
auto file_details = find_file_details(parRedis, parGroupID, parLevel, parPath);
|
||||
return boost::copy_range<std::vector<std::string>>(
|
||||
file_details |
|
||||
transformed([](MaxSizedArray<std::string, 1>& a){return std::move(a.front());})
|
||||
);
|
||||
}
|
||||
} //namespace dindb
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
#include "backends/db_backend.hpp"
|
||||
#include "helpers/MaxSizedArray.hpp"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <boost/utility/string_ref.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
namespace redis {
|
||||
class IncRedis;
|
||||
|
@ -34,6 +37,7 @@ namespace dindb {
|
|||
std::vector<LocatedSet> locate_sets_in_db ( redis::IncRedis& parRedis, const std::string& parSubstr, const std::vector<GroupIDType>& parSets, bool parCaseInsensitive );
|
||||
std::vector<dinhelp::MaxSizedArray<std::string, 4>> find_set_details ( redis::IncRedis& parRedis, const std::vector<GroupIDType>& parSets );
|
||||
std::vector<dinhelp::MaxSizedArray<std::string, 1>> find_file_details ( redis::IncRedis& parRedis, GroupIDType parSetID, uint16_t parLevel, boost::string_ref parDir );
|
||||
std::vector<std::string> find_paths_starting_by ( redis::IncRedis& parRedis, GroupIDType parGroupID, uint16_t parLevel, boost::string_ref parPath );
|
||||
} //namespace dindb
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue