Skip to content

Commit

Permalink
Move header files to include dir (#51)
Browse files Browse the repository at this point in the history
Signed-off-by: sunby <[email protected]>
  • Loading branch information
sunby committed Sep 7, 2023
1 parent 8642905 commit 296fa9c
Show file tree
Hide file tree
Showing 58 changed files with 152 additions and 165 deletions.
8 changes: 4 additions & 4 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ find_package(glog REQUIRED)

file(GLOB_RECURSE SRC_FILES src/*.cpp src/*.cc)
message(STATUS "SRC_FILES: ${SRC_FILES}")
add_library(storage ${SRC_FILES})
target_include_directories(storage PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(storage PUBLIC arrow::libarrow arrow::libparquet Boost::boost protobuf::protobuf)
target_link_libraries(storage PUBLIC glog::glog)
add_library(milvus-storage ${SRC_FILES})
target_include_directories(milvus-storage PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/milvus-storage ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(milvus-storage PUBLIC arrow::libarrow arrow::libparquet Boost::boost protobuf::protobuf)
target_link_libraries(milvus-storage PUBLIC glog::glog)

if (WITH_UT)
enable_testing()
Expand Down
2 changes: 1 addition & 1 deletion cpp/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def configure(self):
def requirements(self):
self.requires("boost/1.81.0")
self.requires("arrow/12.0.0")
self.requires("protobuf/3.21.9")
self.requires("protobuf/3.21.4")
self.requires("glog/0.6.0")
if self.options.with_ut:
self.requires("gtest/1.13.0")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <memory>
#include <string>
#include <unordered_map>
#include "proto/schema.pb.h"
#include "proto/schema_arrow.pb.h"
#include "result.h"

namespace milvus_storage {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "storage/schema.h"
#include "schema.h"
#include "file/fragment.h"
#include "arrow/filesystem/filesystem.h"
#include "file/blob.h"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "storage/options.h"
#include "options.h"
#include "common/result.h"
namespace milvus_storage {

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion cpp/src/common/fs_util.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "fs_util.h"
#include "common/fs_util.h"
#include <arrow/filesystem/localfs.h>
#include <arrow/filesystem/hdfs.h>
#include <arrow/filesystem/s3fs.h>
Expand Down
36 changes: 12 additions & 24 deletions cpp/src/common/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "log.h"
#include "common/log.h"

/*
* INITIALIZE_EASYLOGGINGPP will create a global variable whose name is same to that already created in knowhere,
Expand All @@ -36,8 +36,7 @@

// namespace milvus {

std::string
LogOut(const char* pattern, ...) {
std::string LogOut(const char* pattern, ...) {
size_t len = strnlen(pattern, 1024) + 256;
auto str_p = std::make_unique<char[]>(len);
memset(str_p.get(), 0, len);
Expand All @@ -50,8 +49,7 @@ LogOut(const char* pattern, ...) {
return std::string(str_p.get());
}

void
SetThreadName(const std::string_view name) {
void SetThreadName(const std::string_view name) {
// Note: the name cannot exceed 16 bytes
#ifdef __APPLE__
pthread_setname_np(name.data());
Expand All @@ -62,8 +60,7 @@ SetThreadName(const std::string_view name) {
#endif
}

std::string
GetThreadName() {
std::string GetThreadName() {
std::string thread_name = "unnamed";
char name[16];
size_t len = 16;
Expand All @@ -75,16 +72,14 @@ GetThreadName() {
return thread_name;
}

int64_t
get_now_timestamp() {
int64_t get_now_timestamp() {
auto now = std::chrono::system_clock::now().time_since_epoch();
return std::chrono::duration_cast<std::chrono::seconds>(now).count();
}

#ifndef WIN32

int64_t
get_system_boottime() {
int64_t get_system_boottime() {
FILE* uptime = fopen("/proc/uptime", "r");
float since_sys_boot, _;
auto ret = fscanf(uptime, "%f %f", &since_sys_boot, &_);
Expand All @@ -95,8 +90,7 @@ get_system_boottime() {
return static_cast<int64_t>(since_sys_boot);
}

int64_t
get_thread_starttime() {
int64_t get_thread_starttime() {
#ifdef __APPLE__
uint64_t tid;
pthread_threadid_np(nullptr, &tid);
Expand All @@ -108,17 +102,14 @@ get_thread_starttime() {

int64_t pid = getpid();
char filename[256];
snprintf(filename,
sizeof(filename),
"/proc/%lld/task/%lld/stat",
snprintf(filename, sizeof(filename), "/proc/%lld/task/%lld/stat",
(long long)pid, // NOLINT, TODO: How to solve this?
(long long)tid); // NOLINT

int64_t val = 0;
char comm[16], state;
FILE* thread_stat = fopen(filename, "r");
auto ret = fscanf(
thread_stat, "%lld %s %s ", (long long*)&val, comm, &state); // NOLINT
auto ret = fscanf(thread_stat, "%lld %s %s ", (long long*)&val, comm, &state); // NOLINT

for (auto i = 4; i < 23; i++) {
ret = fscanf(thread_stat, "%lld ", (long long*)&val); // NOLINT
Expand All @@ -133,11 +124,9 @@ get_thread_starttime() {
return val / sysconf(_SC_CLK_TCK);
}

int64_t
get_thread_start_timestamp() {
int64_t get_thread_start_timestamp() {
try {
return get_now_timestamp() - get_system_boottime() +
get_thread_starttime();
return get_now_timestamp() - get_system_boottime() + get_thread_starttime();
} catch (...) {
return 0;
}
Expand All @@ -148,8 +137,7 @@ get_thread_start_timestamp() {
#define WINDOWS_TICK 10000000
#define SEC_TO_UNIX_EPOCH 11644473600LL

int64_t
get_thread_start_timestamp() {
int64_t get_thread_start_timestamp() {
FILETIME dummy;
FILETIME ret;

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/common/result.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include "result.h"
#include "common/result.h"

namespace milvus_storage {} // namespace milvus_storage
2 changes: 1 addition & 1 deletion cpp/src/common/status.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "status.h"
#include "common/status.h"
#include <cstdio>
#include <string>
namespace milvus_storage {
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/common/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "utils.h"
#include "common/utils.h"
#include <arrow/type_fwd.h>
#include <arrow/util/key_value_metadata.h>
#include <memory>
Expand All @@ -7,8 +7,8 @@
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <string>
#include "constants.h"
#include "macro.h"
#include "common/constants.h"
#include "common/macro.h"
#include "arrow/filesystem/path_util.h"
#include <cstdlib>
namespace milvus_storage {
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/file/blob.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "blob.h"
#include "file/blob.h"
#include <memory>
#include "proto/manifest.pb.h"

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/filter/conjunction_filter.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "conjunction_filter.h"
#include "filter/conjunction_filter.h"
#include "common/macro.h"

namespace milvus_storage {
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/filter/constant_filter.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "constant_filter.h"
#include "filter/constant_filter.h"

#include <arrow/array/array_primitive.h>
#include <arrow/type_fwd.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/filter/value.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "value.h"
#include "filter/value.h"

#include <cstdint>

Expand Down
1 change: 0 additions & 1 deletion cpp/src/format/parquet/file_reader.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "format/parquet/file_reader.h"

#include <arrow/dataset/scanner.h>
#include <arrow/record_batch.h>
#include <arrow/table_builder.h>
#include <arrow/type_fwd.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/format/parquet/file_writer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "common/macro.h"
#include "file_writer.h"
#include "format/parquet/file_writer.h"
namespace milvus_storage {

ParquetFileWriter::ParquetFileWriter(std::shared_ptr<arrow::Schema> schema,
Expand Down
28 changes: 14 additions & 14 deletions cpp/src/proto/manifest.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cpp/src/proto/manifest.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cpp/src/proto/manifest.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";
import "schema.proto";

package manifest_proto;
import "schema_arrow.proto";

message Options { string uri = 1; }

message Manifest {
Expand Down
Loading

0 comments on commit 296fa9c

Please sign in to comment.