From d3dd8e9cc0c7470b5be82591c92e2adb7429e4f7 Mon Sep 17 00:00:00 2001 From: one-more-bowl-at-most Date: Fri, 12 Dec 2025 01:58:26 +0800 Subject: [PATCH] adapt to omnistream --- src/core/db/boost_state_db_impl.h | 1 + src/core/include/binary_data.h | 2 +- src/core/include/boost_state_db.h | 2 + src/core/include/bss_def.h | 75 +++++++++++++++++++ src/core/include/value_type.h | 27 +++++++ .../com_huawei_ock_bss_table_BoostPQTable.cpp | 1 + 6 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 src/core/include/bss_def.h create mode 100644 src/core/include/value_type.h diff --git a/src/core/db/boost_state_db_impl.h b/src/core/db/boost_state_db_impl.h index 0d19097..589a5cd 100644 --- a/src/core/db/boost_state_db_impl.h +++ b/src/core/db/boost_state_db_impl.h @@ -19,6 +19,7 @@ #include "snapshot/savepoint_data_view.h" #include "transform/fresh_transformer.h" #include "common/bss_metric.h" +#include "pq_table.h" namespace ock { namespace bss { diff --git a/src/core/include/binary_data.h b/src/core/include/binary_data.h index dbd1240..69a5a4d 100644 --- a/src/core/include/binary_data.h +++ b/src/core/include/binary_data.h @@ -17,7 +17,7 @@ #include #include -#include "binary/value/value_type.h" +#include "value_type.h" #include "bss_def.h" #include "bss_types.h" #include "buffer.h" diff --git a/src/core/include/boost_state_db.h b/src/core/include/boost_state_db.h index b3fe065..154dd6c 100644 --- a/src/core/include/boost_state_db.h +++ b/src/core/include/boost_state_db.h @@ -26,6 +26,8 @@ namespace bss { class SavepointDataView; class SnapshotOperatorCoordinator; class BoostNativeMetric; +class PQTable; +using PQTableRef = std::shared_ptr; class BoostStateDB : public AutoCloseable { public: diff --git a/src/core/include/bss_def.h b/src/core/include/bss_def.h new file mode 100644 index 0000000..d674d9a --- /dev/null +++ b/src/core/include/bss_def.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +#ifndef BOOST_STATE_STORE_DEF_H +#define BOOST_STATE_STORE_DEF_H + +#include + +#include "include/bss_err.h" +#include "include/bss_types.h" + +namespace ock { +namespace bss { +#ifndef ROUND_UP +#define ROUND_UP(x, align) (((x) + (align)-1) & ~((align)-1)) +#endif + +#ifndef ROUND_DOWN +#define ROUND_DOWN(x, align) ((x) & ~((align)-1)) +#endif + +#ifndef LIKELY +#define LIKELY(x) (__builtin_expect(!!(x), 1) != 0) +#endif + +#ifndef UNLIKELY +#define UNLIKELY(x) (__builtin_expect(!!(x), 0) != 0) +#endif + +#ifndef UNREFERENCE_PARAM +#define UNREFERENCE_PARAM(x) ((void)(x)) +#endif + +#ifndef COMPARE_PARAM_WITH_NULLPTR +#define COMPARE_PARAM_WITH_NULLPTR(k1, k2) \ + do { \ + if (UNLIKELY((k1) == nullptr && (k2) == nullptr)) { \ + return 0; \ + } \ + if (UNLIKELY((k1) == nullptr && (k2) != nullptr)) { \ + return -1; \ + } \ + if (UNLIKELY((k1) != nullptr && (k2) == nullptr)) { \ + return 1; \ + } \ + } while (0) +#endif + +#define KB_UNIT (1024) + +#define POWER_OF_2(x) ((((x)-1) & (x)) == 0) + +#define FLOAT_MAX_VALUE std::numeric_limits::max() +#define DOUBLE_MAX_VALUE std::numeric_limits::max() + +#define MA_LEN_LEN (NO_4) +#define MA_CANARY_LEN (NO_5) +#define MA_META_DATA_RESERVE_LEN \ + (NO_16) /* total reserve length, for memcpy's performance, 16 bytes alignment \ +is best */ + +#define SUPPORT_SLICE_SORT true +#define ENABLE_MEMORY_TRACKER false +#define ENABLE_MEMORY_MONITOR false +} // namespace bss +} // namespace ock +#endif // BOOST_STATE_STORE_DEF_H \ No newline at end of file diff --git a/src/core/include/value_type.h b/src/core/include/value_type.h new file mode 100644 index 0000000..1e56a2a --- /dev/null +++ b/src/core/include/value_type.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +#ifndef BOOST_SS_VALUE_TYPE_H +#define BOOST_SS_VALUE_TYPE_H + +namespace ock { +namespace bss { +enum ValueType : unsigned char { + DELETE = 1, + PUT = 2, + APPEND = 3, + SEPARATE = 4, + TYPE_BUTT = 5, +}; +} +} // namespace ock + +#endif // BOOST_SS_VALUE_TYPE_H \ No newline at end of file diff --git a/src/core/jni/com_huawei_ock_bss_table_BoostPQTable.cpp b/src/core/jni/com_huawei_ock_bss_table_BoostPQTable.cpp index acd7ee3..2603528 100644 --- a/src/core/jni/com_huawei_ock_bss_table_BoostPQTable.cpp +++ b/src/core/jni/com_huawei_ock_bss_table_BoostPQTable.cpp @@ -15,6 +15,7 @@ #include "include/config.h" #include "jvm_instance.h" #include "scope_guard.h" +#include "pq_table.h" using namespace ock::bss; -- Gitee