ValidationUtil.h 2.1 KB
Newer Older
J
jinhai 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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.


J
jinhai 已提交
19 20
#pragma once

21
#include "db/meta/MetaTypes.h"
S
starlord 已提交
22
#include "utils/Status.h"
J
jinhai 已提交
23 24 25 26 27

namespace zilliz {
namespace milvus {
namespace server {

28
class ValidationUtil {
S
starlord 已提交
29 30 31
private:
    ValidationUtil() = default;

32
public:
S
starlord 已提交
33
    static Status
34
    ValidateTableName(const std::string &table_name);
J
jinhai 已提交
35

S
starlord 已提交
36
    static Status
37
    ValidateTableDimension(int64_t dimension);
J
jinhai 已提交
38

S
starlord 已提交
39
    static Status
40 41
    ValidateTableIndexType(int32_t index_type);

S
starlord 已提交
42
    static Status
S
starlord 已提交
43 44
    ValidateTableIndexNlist(int32_t nlist);

S
starlord 已提交
45
    static Status
46
    ValidateTableIndexFileSize(int64_t index_file_size);
S
starlord 已提交
47

S
starlord 已提交
48
    static Status
S
starlord 已提交
49 50
    ValidateTableIndexMetricType(int32_t metric_type);

S
starlord 已提交
51
    static Status
52 53
    ValidateSearchTopk(int64_t top_k, const engine::meta::TableSchema& table_schema);

S
starlord 已提交
54
    static Status
55 56
    ValidateSearchNprobe(int64_t nprobe, const engine::meta::TableSchema& table_schema);

S
starlord 已提交
57
    static Status
58 59
    ValidateGpuIndex(uint32_t gpu_index);

S
starlord 已提交
60
    static Status
61
    GetGpuMemory(uint32_t gpu_index, size_t &memory);
62

S
starlord 已提交
63
    static Status
Z
zhiru 已提交
64 65
    ValidateIpAddress(const std::string &ip_address);

S
starlord 已提交
66
    static Status
Z
zhiru 已提交
67 68
    ValidateStringIsNumber(const std::string &str);

S
starlord 已提交
69
    static Status
Y
yudong.cai 已提交
70
    ValidateStringIsBool(const std::string &str);
Z
zhiru 已提交
71

S
starlord 已提交
72
    static Status
Y
yudong.cai 已提交
73
    ValidateStringIsFloat(const std::string &str);
Z
zhiru 已提交
74

S
starlord 已提交
75
    static Status
Z
zhiru 已提交
76
    ValidateDbURI(const std::string &uri);
77
};
J
jinhai 已提交
78 79 80 81

}
}
}