Skip to content

Commit 6d9de18

Browse files
authored
[C++][Improvement] Redesign and unify the implementation of validation in C++ Writer/Builder (#186)
1 parent 8ff4d99 commit 6d9de18

10 files changed

+762
-320
lines changed

cpp/include/gar/utils/writer_utils.h

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/** Copyright 2022 Alibaba Group Holding Limited.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
16+
#ifndef GAR_UTILS_WRITER_UTILS_H_
17+
#define GAR_UTILS_WRITER_UTILS_H_
18+
19+
#include "gar/utils/macros.h"
20+
21+
namespace GAR_NAMESPACE_INTERNAL {
22+
23+
/**
24+
* @brief The level for validating writing operations.
25+
*/
26+
enum class ValidateLevel : char {
27+
/// To use the default validate level of the writer/builder.
28+
default_validate = 0,
29+
/// To skip the validation.
30+
no_validate = 1,
31+
/// Weak validation: check if the index, count, adj_list type, property group
32+
/// and the size of the table passed to the writer/builder are valid.
33+
weak_validate = 2,
34+
/// Strong validation: except for the weak validation, also check if the
35+
/// schema (including each property name and data type) of the intput data
36+
/// passed to the writer/builder is consistent with that defined in the info.
37+
strong_validate = 3
38+
};
39+
40+
} // namespace GAR_NAMESPACE_INTERNAL
41+
#endif // GAR_UTILS_WRITER_UTILS_H_

0 commit comments

Comments
 (0)