Utils.h 2.0 KB
Newer Older
1
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
J
jinhai 已提交
2
//
3 4
// 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
J
jinhai 已提交
5
//
6 7 8 9 10
// 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 已提交
11

X
Xu Peng 已提交
12 13
#pragma once

14 15 16
#include <ctime>
#include <string>

S
starlord 已提交
17
#include "Options.h"
18
#include "db/Types.h"
S
starlord 已提交
19
#include "db/meta/MetaTypes.h"
S
starlord 已提交
20

J
jinhai 已提交
21
namespace milvus {
X
Xu Peng 已提交
22 23 24
namespace engine {
namespace utils {

S
starlord 已提交
25 26
int64_t
GetMicroSecTimeStamp();
X
Xu Peng 已提交
27

S
starlord 已提交
28
Status
S
starlord 已提交
29
CreateTablePath(const DBMetaOptions& options, const std::string& table_id);
S
starlord 已提交
30
Status
S
starlord 已提交
31
DeleteTablePath(const DBMetaOptions& options, const std::string& table_id, bool force = true);
S
starlord 已提交
32

S
starlord 已提交
33
Status
S
starlord 已提交
34
CreateTableFilePath(const DBMetaOptions& options, meta::TableFileSchema& table_file);
S
starlord 已提交
35
Status
S
starlord 已提交
36
GetTableFilePath(const DBMetaOptions& options, meta::TableFileSchema& table_file);
S
starlord 已提交
37
Status
S
starlord 已提交
38
DeleteTableFilePath(const DBMetaOptions& options, meta::TableFileSchema& table_file);
39 40 41 42 43
Status
DeleteSegment(const DBMetaOptions& options, meta::TableFileSchema& table_file);

Status
GetParentPath(const std::string& path, std::string& parent_path);
S
starlord 已提交
44

S
starlord 已提交
45
bool
S
starlord 已提交
46
IsSameIndex(const TableIndex& index1, const TableIndex& index2);
47

48 49 50
bool
IsRawIndexType(int32_t type);

51 52 53 54 55 56
static bool
IsBinaryIndexType(int32_t index_type);

bool
IsBinaryMetricType(int32_t metric_type);

S
starlord 已提交
57
meta::DateT
S
starlord 已提交
58
GetDate(const std::time_t& t, int day_delta = 0);
S
starlord 已提交
59 60 61 62
meta::DateT
GetDate();
meta::DateT
GetDateWithDelta(int day_delta);
63

64 65 66 67 68 69 70 71 72
struct MetaUriInfo {
    std::string dialect_;
    std::string username_;
    std::string password_;
    std::string host_;
    std::string port_;
    std::string db_name_;
};

S
starlord 已提交
73
Status
S
starlord 已提交
74
ParseMetaUri(const std::string& uri, MetaUriInfo& info);
75

S
starlord 已提交
76 77 78
}  // namespace utils
}  // namespace engine
}  // namespace milvus