enhance: removed unused map_c (#44183)

Signed-off-by: Buqian Zheng <zhengbuqian@gmail.com>
This commit is contained in:
Buqian Zheng 2025-09-09 16:46:04 +08:00 committed by GitHub
parent e2eb8562f1
commit dae0fd0e90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 0 additions and 129 deletions

View File

@ -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<std::string, std::string>;
@ -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;

View File

@ -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 <memory>
#include <map>
#include <string>
using Map = std::map<std::string, std::string>;
CMap
create_cmap() {
auto m = std::make_unique<Map>();
return m.release();
}
void
free_cmap(CMap m) {
delete static_cast<Map*>(m);
}
void
cmap_set(CMap m,
const char* key,
uint32_t key_len,
const char* value,
uint32_t value_len) {
auto mm = static_cast<Map*>(m);
(*mm)[std::string(key, key_len)] = std::string(value, value_len);
}

View File

@ -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 <stdint.h>
#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

View File

@ -13,7 +13,6 @@
#include <stdint.h>
#include "map_c.h"
#include "common/type_c.h"
#ifdef __cplusplus

View File

@ -13,7 +13,6 @@
#include <stdint.h>
#include "segcore/map_c.h"
#include "segcore/token_stream_c.h"
#include "common/type_c.h"

View File

@ -1,45 +0,0 @@
package canalyzer
/*
#cgo pkg-config: milvus_core
#include <stdlib.h> // 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)
}
}