1/**
2 * Copyright 2021 Alibaba, Inc. and its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15
16 * \author Hongqing.hu
17 * \date Nov 2020
18 * \brief Implementation of Bilin Error
19 */
20
21#include "error_code.h"
22#include <aitheta2/index_error.h>
23
24namespace proxima {
25namespace be {
26
27// 0~999 [Builtin]
28PROXIMA_BE_ERROR_CODE_DEFINE(Success, 0, "Success");
29
30// 1000~1999 [Common Error]
31PROXIMA_BE_ERROR_CODE_DEFINE(RuntimeError, 1000, "Runtime Error");
32PROXIMA_BE_ERROR_CODE_DEFINE(LogicError, 1001, "Logic Error");
33PROXIMA_BE_ERROR_CODE_DEFINE(StatusError, 1002, "Status Error");
34PROXIMA_BE_ERROR_CODE_DEFINE(LoadConfig, 1003, "Load Config Error");
35PROXIMA_BE_ERROR_CODE_DEFINE(ConfigError, 1004, "Config Error");
36PROXIMA_BE_ERROR_CODE_DEFINE(InvalidArgument, 1005, "Invalid Arugment");
37PROXIMA_BE_ERROR_CODE_DEFINE(NotInitialized, 1006, "Not Initialized");
38PROXIMA_BE_ERROR_CODE_DEFINE(OpenFile, 1007, "Open File Error");
39PROXIMA_BE_ERROR_CODE_DEFINE(ReadData, 1008, "Read Data Error");
40PROXIMA_BE_ERROR_CODE_DEFINE(WriteData, 1009, "Write Data Error");
41PROXIMA_BE_ERROR_CODE_DEFINE(ExceedLimit, 1010, "Exceed Limit");
42PROXIMA_BE_ERROR_CODE_DEFINE(SerializeError, 1011, "Serialize Error");
43PROXIMA_BE_ERROR_CODE_DEFINE(DeserializeError, 1012, "Deserialize Error");
44PROXIMA_BE_ERROR_CODE_DEFINE(StartServer, 1013, "Start Server Error");
45PROXIMA_BE_ERROR_CODE_DEFINE(StoppedService, 1014, "Visit Stopped Service");
46
47// 2000~2999 [Format Check]
48PROXIMA_BE_ERROR_CODE_DEFINE(EmptyCollectionName, 2000,
49 "Empty Collection Name");
50PROXIMA_BE_ERROR_CODE_DEFINE(EmptyColumnName, 2001, "Empty Column Name");
51PROXIMA_BE_ERROR_CODE_DEFINE(EmptyColumns, 2002, "Empty Columns");
52PROXIMA_BE_ERROR_CODE_DEFINE(EmptyRepositoryTable, 2003,
53 "Empty Repository Table");
54PROXIMA_BE_ERROR_CODE_DEFINE(EmptyRepositoryName, 2004,
55 "Empty Repository Name");
56PROXIMA_BE_ERROR_CODE_DEFINE(EmptyUserName, 2005, "Empty User Name");
57PROXIMA_BE_ERROR_CODE_DEFINE(EmptyPassword, 2006, "Empty Password");
58PROXIMA_BE_ERROR_CODE_DEFINE(InvalidURI, 2007, "Invalid URI");
59PROXIMA_BE_ERROR_CODE_DEFINE(InvalidCollectionStatus, 2008,
60 "Invalid Collection Status");
61PROXIMA_BE_ERROR_CODE_DEFINE(InvalidRecord, 2009, "Invalid Record");
62PROXIMA_BE_ERROR_CODE_DEFINE(InvalidQuery, 2010, "Invalid Query");
63PROXIMA_BE_ERROR_CODE_DEFINE(InvalidIndexDataFormat, 2011,
64 "Invalid Index Data Format");
65PROXIMA_BE_ERROR_CODE_DEFINE(InvalidWriteRequest, 2012,
66 "Invalid Write Request");
67PROXIMA_BE_ERROR_CODE_DEFINE(InvalidVectorFormat, 2013,
68 "Invalid Vector Format");
69PROXIMA_BE_ERROR_CODE_DEFINE(InvalidRepositoryType, 2014,
70 "Invalid Repository Type");
71PROXIMA_BE_ERROR_CODE_DEFINE(InvalidDataType, 2015, "Invalid Data Type");
72PROXIMA_BE_ERROR_CODE_DEFINE(InvalidIndexType, 2016, "Invalid Index Type");
73PROXIMA_BE_ERROR_CODE_DEFINE(InvalidSegment, 2017, "Invalid Segment");
74PROXIMA_BE_ERROR_CODE_DEFINE(InvalidRevision, 2018, "Invalid Revision");
75PROXIMA_BE_ERROR_CODE_DEFINE(InvalidFeature, 2019, "Invalid Feature");
76PROXIMA_BE_ERROR_CODE_DEFINE(MismatchedSchema, 2020, "Mismatched schema");
77PROXIMA_BE_ERROR_CODE_DEFINE(MismatchedMagicNumber, 2021,
78 "Mismatched Magic Number");
79PROXIMA_BE_ERROR_CODE_DEFINE(MismatchedIndexColumn, 2022,
80 "Mismatched Index Column");
81PROXIMA_BE_ERROR_CODE_DEFINE(MismatchedDimension, 2023, "Mismatched Dimension");
82PROXIMA_BE_ERROR_CODE_DEFINE(MismatchedDataType, 2024, "Mismatched Data Type");
83
84// 3000~3999 [Meta]
85PROXIMA_BE_ERROR_CODE_DEFINE(UpdateStatusField, 3000,
86 "Status Field Is Readonly");
87PROXIMA_BE_ERROR_CODE_DEFINE(UpdateRevisionField, 3001,
88 "Revision Field Is Readonly");
89PROXIMA_BE_ERROR_CODE_DEFINE(UpdateCollectionUIDField, 3002,
90 "CollectionUID Field Is Readonly");
91PROXIMA_BE_ERROR_CODE_DEFINE(UpdateIndexTypeField, 3003,
92 "IndexType Field Is Readonly");
93PROXIMA_BE_ERROR_CODE_DEFINE(UpdateDataTypeField, 3004,
94 "DataType Field Is Readonly");
95PROXIMA_BE_ERROR_CODE_DEFINE(UpdateParametersField, 3005,
96 "Parameters Filed Is Readonly");
97PROXIMA_BE_ERROR_CODE_DEFINE(UpdateRepositoryTypeField, 3006,
98 "RepositoryType Field Is Readonly");
99PROXIMA_BE_ERROR_CODE_DEFINE(UpdateColumnNameField, 3007,
100 "Update ColumnName Field Is Readonly");
101PROXIMA_BE_ERROR_CODE_DEFINE(ZeroDocsPerSegment, 3008, "Zero Docs Per Segment");
102PROXIMA_BE_ERROR_CODE_DEFINE(UnsupportedConnection, 3009,
103 "Unsupported Connection");
104
105// 4000~4999 [Index]
106PROXIMA_BE_ERROR_CODE_DEFINE(DuplicateCollection, 4000, "Duplicate Collection");
107PROXIMA_BE_ERROR_CODE_DEFINE(DuplicateKey, 4001, "Duplicate Key");
108PROXIMA_BE_ERROR_CODE_DEFINE(InexistentCollection, 4002,
109 "Collection Not Exist");
110PROXIMA_BE_ERROR_CODE_DEFINE(InexistentColumn, 4003, "Column Not Exist");
111PROXIMA_BE_ERROR_CODE_DEFINE(InexistentKey, 4004, "Key Not Exist");
112PROXIMA_BE_ERROR_CODE_DEFINE(SuspendedCollection, 4005,
113 "Collection Is Suspended");
114PROXIMA_BE_ERROR_CODE_DEFINE(LostSegment, 4006, "Lost Segment");
115PROXIMA_BE_ERROR_CODE_DEFINE(EmptyLsnContext, 4007, "Empty Lsn Context");
116PROXIMA_BE_ERROR_CODE_DEFINE(ExceedRateLimit, 4008, "Exceed Rate Limit");
117
118// 5000~5999 [Query]
119PROXIMA_BE_ERROR_CODE_DEFINE(UnavailableSegment, 5000,
120 "Segment Is "
121 "unavailable");
122PROXIMA_BE_ERROR_CODE_DEFINE(MismatchedForward, 5001, "Mismatched Forward");
123PROXIMA_BE_ERROR_CODE_DEFINE(OutOfBoundsResult, 5002, "Results Out Of Bounds");
124PROXIMA_BE_ERROR_CODE_DEFINE(UnreadyQueue, 5003,
125 "Compute Queue Is Unready Yet");
126PROXIMA_BE_ERROR_CODE_DEFINE(ScheduleError, 5004, "Schedule Task Error");
127PROXIMA_BE_ERROR_CODE_DEFINE(UnreadableCollection, 5005,
128 "Collection Is Unreadable");
129PROXIMA_BE_ERROR_CODE_DEFINE(TaskIsRunning, 5006,
130 "Task is running in other coroutine");
131
132// NOTICE
133// 10000~19999 [SDK]
134// 20000~29999 [Repository]
135
136
137const char *ErrorCode::What(int val) {
138 if (val >= -1000) {
139 return aitheta2::IndexError::What(val);
140 } else {
141 return ErrorCode::Instance()->what(val);
142 }
143}
144
145} // namespace be
146} // end namespace proxima
147