diff --git a/internal/core/src/segcore/TokenizerCTest.cpp b/internal/core/src/segcore/TokenizerCTest.cpp index 2722538492..a3934795c3 100644 --- a/internal/core/src/segcore/TokenizerCTest.cpp +++ b/internal/core/src/segcore/TokenizerCTest.cpp @@ -16,7 +16,6 @@ #include "pb/schema.pb.h" #include "segcore/token_stream_c.h" #include "segcore/tokenizer_c.h" -#include "segcore/map_c.h" using Map = std::map; @@ -42,11 +41,6 @@ TEST(ValidateTextSchema, JieBa) { ASSERT_EQ(milvus::ErrorCode::Success, status.error_code); } -void -set_cmap(CMap m, const std::string& key, const std::string& value) { - cmap_set(m, key.c_str(), key.length(), value.c_str(), value.length()); -} - TEST(CTokenizer, Default) { auto analyzer_params = R"({"tokenizer": "standard"})"; CTokenizer tokenizer; diff --git a/internal/core/src/segcore/map_c.cpp b/internal/core/src/segcore/map_c.cpp deleted file mode 100644 index e0a21f1c38..0000000000 --- a/internal/core/src/segcore/map_c.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2019-2020 Zilliz. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software distributed under the License -// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express -// or implied. See the License for the specific language governing permissions and limitations under the License - -#include "segcore/map_c.h" - -#include -#include -#include - -using Map = std::map; - -CMap -create_cmap() { - auto m = std::make_unique(); - return m.release(); -} - -void -free_cmap(CMap m) { - delete static_cast(m); -} - -void -cmap_set(CMap m, - const char* key, - uint32_t key_len, - const char* value, - uint32_t value_len) { - auto mm = static_cast(m); - (*mm)[std::string(key, key_len)] = std::string(value, value_len); -} diff --git a/internal/core/src/segcore/map_c.h b/internal/core/src/segcore/map_c.h deleted file mode 100644 index 74a6f10f05..0000000000 --- a/internal/core/src/segcore/map_c.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2019-2020 Zilliz. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software distributed under the License -// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express -// or implied. See the License for the specific language governing permissions and limitations under the License - -#pragma once - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void* CMap; - -CMap -create_cmap(); - -void -free_cmap(CMap m); - -void -cmap_set(CMap m, - const char* key, - uint32_t key_len, - const char* value, - uint32_t value_len); - -#ifdef __cplusplus -} -#endif diff --git a/internal/core/src/segcore/token_stream_c.h b/internal/core/src/segcore/token_stream_c.h index c19ae87113..06f634905d 100644 --- a/internal/core/src/segcore/token_stream_c.h +++ b/internal/core/src/segcore/token_stream_c.h @@ -13,7 +13,6 @@ #include -#include "map_c.h" #include "common/type_c.h" #ifdef __cplusplus diff --git a/internal/core/src/segcore/tokenizer_c.h b/internal/core/src/segcore/tokenizer_c.h index 8b13cdb41e..d803c8e533 100644 --- a/internal/core/src/segcore/tokenizer_c.h +++ b/internal/core/src/segcore/tokenizer_c.h @@ -13,7 +13,6 @@ #include -#include "segcore/map_c.h" #include "segcore/token_stream_c.h" #include "common/type_c.h" diff --git a/internal/util/analyzer/canalyzer/c_map.go b/internal/util/analyzer/canalyzer/c_map.go deleted file mode 100644 index f7a364f780..0000000000 --- a/internal/util/analyzer/canalyzer/c_map.go +++ /dev/null @@ -1,45 +0,0 @@ -package canalyzer - -/* -#cgo pkg-config: milvus_core -#include // free -#include "segcore/map_c.h" -*/ -import "C" -import "unsafe" - -type CMap struct { - ptr C.CMap -} - -func NewCMap() *CMap { - return &CMap{ - ptr: C.create_cmap(), - } -} - -func (m *CMap) GetPointer() C.CMap { - return m.ptr -} - -func (m *CMap) Set(key string, value string) { - cKey := C.CString(key) - defer C.free(unsafe.Pointer(cKey)) - - cValue := C.CString(value) - defer C.free(unsafe.Pointer(cValue)) - - C.cmap_set(m.ptr, cKey, (C.uint32_t)(len(key)), cValue, (C.uint32_t)(len(value))) -} - -func (m *CMap) From(gm map[string]string) { - for k, v := range gm { - m.Set(k, v) - } -} - -func (m *CMap) Destroy() { - if m.ptr != nil { - C.free_cmap(m.ptr) - } -}