5 #ifndef RICE_HDFS_UTIL_H
6 #define RICE_HDFS_UTIL_H
7 #include <boost/uuid/uuid.hpp>
8 #include <boost/uuid/uuid_generators.hpp>
18 inline void generate_block_id(std::uint64_t &uuid) {
19 auto bytes = boost::uuids::random_generator()();
20 memcpy((&uuid), &bytes,
sizeof(std::uint64_t));
22 uuid = uuid & ((1ull << 63) - 1);
31 inline std::string concat_path(
const std::string& str1,
const std::string& str2){
32 std::string new_path = str1;
34 if (str1.back() !=
'/' && str2.at(0) !=
'/'){
37 else if (str1.back() ==
'/' && str2.at(0) ==
'/'){
38 new_path = str1.substr(0, str1.size() - 1);
41 if (new_path.at(new_path.length() - 1) ==
'/'){
47 #endif //RICE_HDFS_UTIL_H