Flex  0.17.9
schema.h
Go to the documentation of this file.
1 
16 #ifndef GRAPHSCOPE_FRAGMENT_SCHEMA_H_
17 #define GRAPHSCOPE_FRAGMENT_SCHEMA_H_
18 
19 #include "flex/engines/hqps_db/core/utils/hqps_utils.h"
21 #include "flex/utils/id_indexer.h"
24 #include "flex/utils/result.h"
25 #include "flex/utils/yaml_utils.h"
26 
27 namespace gs {
28 
29 class Schema {
30  public:
31  // How many built-in plugins are there.
32  // Currently only one builtin plugin, SERVER_APP is supported.
33  static constexpr uint8_t RESERVED_PLUGIN_NUM = 1;
34  static constexpr uint8_t MAX_PLUGIN_ID = 245;
35  static constexpr uint8_t ADHOC_READ_PLUGIN_ID = 253;
36  static constexpr uint8_t HQPS_ADHOC_READ_PLUGIN_ID = 254;
37  static constexpr uint8_t HQPS_ADHOC_WRITE_PLUGIN_ID = 255;
38 
39  static constexpr uint8_t CYPHER_READ_PLUGIN_ID = 248;
40  static constexpr uint8_t CYPHER_WRITE_PLUGIN_ID = 247;
41  static constexpr uint8_t CYPHER_READ_DEBUG_PLUGIN_ID = 246;
42  static constexpr const char* HQPS_ADHOC_READ_PLUGIN_ID_STR = "\xFE";
43  static constexpr const char* HQPS_ADHOC_WRITE_PLUGIN_ID_STR = "\xFF";
44  static constexpr const char* ADHOC_READ_PLUGIN_ID_STR = "\xFD";
45  static constexpr const char* CYPHER_READ_DEBUG_PLUGIN_ID_STR = "\xF6";
46  static constexpr const char* PRIMITIVE_TYPE_KEY = "primitive_type";
47  static constexpr const char* VARCHAR_KEY = "varchar";
48  static constexpr const char* MAX_LENGTH_KEY = "max_length";
49  static constexpr const uint16_t STRING_DEFAULT_MAX_LENGTH = 256;
50 
51  // The builtin plugins are reserved for the system.
52  static constexpr uint8_t BUILTIN_PLUGIN_NUM = 4;
53 
54  static constexpr uint8_t BUILTIN_COUNT_VERTICES_PLUGIN_ID = 252;
55  static constexpr const char* BUILTIN_COUNT_VERTICES_PLUGIN_NAME =
56  "count_vertices";
57  static constexpr uint8_t BUILTIN_PAGERANK_PLUGIN_ID = 251;
58  static constexpr const char* BUILTIN_PAGERANK_PLUGIN_NAME = "pagerank";
59  static constexpr uint8_t BUILTIN_K_DEGREE_NEIGHBORS_PLUGIN_ID = 250;
60  static constexpr const char* BUILTIN_K_DEGREE_NEIGHBORS_PLUGIN_NAME =
61  "k_neighbors";
62  static constexpr uint8_t BUILTIN_TVSP_PLUGIN_ID = 249;
63  static constexpr const char* BUILTIN_TVSP_PLUGIN_NAME =
64  "shortest_path_among_three";
65  static constexpr const char* BUILTIN_PLUGIN_NAMES[BUILTIN_PLUGIN_NUM] = {
68  static constexpr uint8_t BUILTIN_PLUGIN_IDS[BUILTIN_PLUGIN_NUM] = {
71 
72  // An array containing all compatible versions of schema.
73  static const std::vector<std::string> COMPATIBLE_VERSIONS;
74  static constexpr const char* DEFAULT_SCHEMA_VERSION = "v0.0";
75 
76  static bool IsBuiltinPlugin(const std::string& plugin_name);
77 
79  Schema();
80  ~Schema();
81 
82  static const std::vector<std::string>& GetCompatibleVersions();
83 
84  void Clear();
85 
86  void add_vertex_label(
87  const std::string& label, const std::vector<PropertyType>& property_types,
88  const std::vector<std::string>& property_names,
89  const std::vector<std::tuple<PropertyType, std::string, size_t>>&
90  primary_key,
91  const std::vector<StorageStrategy>& strategies = {},
92  size_t max_vnum = static_cast<size_t>(1) << 32,
93  const std::string& description = "");
94 
95  void add_edge_label(const std::string& src_label,
96  const std::string& dst_label,
97  const std::string& edge_label,
98  const std::vector<PropertyType>& properties,
99  const std::vector<std::string>& prop_names,
102  bool oe_mutable = true, bool ie_mutable = true,
103  bool sort_on_compaction = false,
104  const std::string& description = "");
105 
106  label_t vertex_label_num() const;
107 
108  label_t edge_label_num() const;
109 
110  bool contains_vertex_label(const std::string& label) const;
111 
112  label_t get_vertex_label_id(const std::string& label) const;
113 
115  label_t label_id, const std::vector<PropertyType>& types,
116  const std::vector<StorageStrategy>& strategies = {});
117 
118  const std::vector<PropertyType>& get_vertex_properties(
119  const std::string& label) const;
120 
121  const std::vector<std::string>& get_vertex_property_names(
122  const std::string& label) const;
123 
124  const std::string& get_vertex_description(const std::string& label) const;
125 
126  const std::vector<PropertyType>& get_vertex_properties(label_t label) const;
127 
128  const std::vector<std::string>& get_vertex_property_names(
129  label_t label) const;
130 
131  const std::string& get_vertex_description(label_t label) const;
132 
133  const std::vector<StorageStrategy>& get_vertex_storage_strategies(
134  const std::string& label) const;
135 
136  size_t get_max_vnum(const std::string& label) const;
137 
138  bool exist(const std::string& src_label, const std::string& dst_label,
139  const std::string& edge_label) const;
140 
141  bool exist(label_type src_label, label_type dst_label,
142  label_type edge_label) const;
143 
144  const std::vector<PropertyType>& get_edge_properties(
145  const std::string& src_label, const std::string& dst_label,
146  const std::string& label) const;
147 
148  const std::vector<PropertyType>& get_edge_properties(label_t src_label,
149  label_t dst_label,
150  label_t label) const;
151 
152  const std::string& get_compiler_path() const;
153 
154  void set_compiler_path(const std::string& compiler_path);
155 
156  std::string get_edge_description(const std::string& src_label,
157  const std::string& dst_label,
158  const std::string& label) const;
159 
160  std::string get_edge_description(label_t src_label, label_t dst_label,
161  label_t label) const;
162 
163  PropertyType get_edge_property(label_t src, label_t dst, label_t edge) const;
164 
165  const std::vector<std::string>& get_edge_property_names(
166  const std::string& src_label, const std::string& dst_label,
167  const std::string& label) const;
168 
169  const std::vector<std::string>& get_edge_property_names(
170  const label_t& src_label, const label_t& dst_label,
171  const label_t& label) const;
172 
173  bool vertex_has_property(const std::string& label,
174  const std::string& prop) const;
175 
176  bool vertex_has_primary_key(const std::string& label,
177  const std::string& prop) const;
178 
179  bool edge_has_property(const std::string& src_label,
180  const std::string& dst_label,
181  const std::string& edge_label,
182  const std::string& prop) const;
183 
184  bool has_vertex_label(const std::string& label) const;
185 
186  bool has_edge_label(const std::string& src_label,
187  const std::string& dst_label,
188  const std::string& edge_label) const;
189 
190  bool has_edge_label(label_t src_label, label_t dst_label,
191  label_t edge_label) const;
192 
193  bool valid_edge_property(const std::string& src_label,
194  const std::string& dst_label,
195  const std::string& label) const;
196 
197  EdgeStrategy get_outgoing_edge_strategy(const std::string& src_label,
198  const std::string& dst_label,
199  const std::string& label) const;
200 
201  EdgeStrategy get_incoming_edge_strategy(const std::string& src_label,
202  const std::string& dst_label,
203  const std::string& label) const;
204 
206  label_t dst_label,
207  label_t label) const {
208  uint32_t index = generate_edge_label(src_label, dst_label, label);
209  return oe_strategy_.at(index);
210  }
211 
213  label_t dst_label,
214  label_t label) const {
215  uint32_t index = generate_edge_label(src_label, dst_label, label);
216  return ie_strategy_.at(index);
217  }
218 
219  bool outgoing_edge_mutable(const std::string& src_label,
220  const std::string& dst_label,
221  const std::string& label) const;
222 
223  bool incoming_edge_mutable(const std::string& src_label,
224  const std::string& dst_label,
225  const std::string& label) const;
226 
227  bool get_sort_on_compaction(const std::string& src_label,
228  const std::string& dst_label,
229  const std::string& label) const;
230 
231  bool contains_edge_label(const std::string& label) const;
232 
233  label_t get_edge_label_id(const std::string& label) const;
234 
235  std::string get_vertex_label_name(label_t index) const;
236 
237  std::string get_edge_label_name(label_t index) const;
238 
239  const std::vector<std::tuple<PropertyType, std::string, size_t>>&
240  get_vertex_primary_key(label_t index) const;
241 
242  const std::string& get_vertex_primary_key_name(label_t index) const;
243 
244  void Serialize(std::unique_ptr<grape::LocalIOAdaptor>& writer) const;
245 
246  void Deserialize(std::unique_ptr<grape::LocalIOAdaptor>& reader);
247 
248  static Result<Schema> LoadFromYaml(const std::string& schema_config);
249 
250  static Result<Schema> LoadFromYamlNode(const YAML::Node& schema_node);
251 
252  bool Equals(const Schema& other) const;
253 
254  // Return the map from plugin name to plugin id
255  const std::unordered_map<std::string, std::pair<std::string, uint8_t>>&
256  GetPlugins() const;
257 
258  bool EmplacePlugins(
259  const std::vector<std::pair<std::string, std::string>>& plugins);
260 
261  void SetPluginDir(const std::string& plugin_dir);
262 
263  void RemovePlugin(const std::string& plugin_name);
264 
265  std::string GetPluginDir() const;
266 
267  std::string GetDescription() const;
268 
269  void SetDescription(const std::string& description);
270 
271  void SetVersion(const std::string& version);
272 
273  std::string GetVersion() const;
274 
275  bool has_multi_props_edge() const;
276 
277  const std::unordered_map<std::string, std::pair<PropertyType, uint8_t>>&
279 
280  private:
281  label_t vertex_label_to_index(const std::string& label);
282 
283  label_t edge_label_to_index(const std::string& label);
284 
285  uint32_t generate_edge_label(label_t src, label_t dst, label_t edge) const;
286 
289  std::vector<std::vector<PropertyType>> vproperties_;
290  std::vector<std::vector<std::string>> vprop_names_;
291  std::vector<std::string> v_descriptions_;
292  std::vector<std::vector<std::tuple<PropertyType, std::string, size_t>>>
293  v_primary_keys_; // the third element is the index of the property in the
294  // vertex property list
295  std::vector<std::vector<StorageStrategy>> vprop_storage_;
296  std::map<uint32_t, std::vector<PropertyType>> eproperties_;
297  std::map<uint32_t, std::vector<std::string>> eprop_names_;
298  std::map<uint32_t, std::string> e_descriptions_;
299  std::map<uint32_t, EdgeStrategy> oe_strategy_;
300  std::map<uint32_t, EdgeStrategy> ie_strategy_;
301  std::map<uint32_t, bool> oe_mutability_;
302  std::map<uint32_t, bool> ie_mutability_;
303  std::map<uint32_t, bool> sort_on_compactions_;
304  std::vector<std::unordered_map<std::string, std::pair<PropertyType, uint8_t>>>
306  std::vector<size_t> max_vnum_;
307  std::unordered_map<std::string, std::pair<std::string, uint8_t>>
308  plugin_name_to_path_and_id_; // key is plugin_name, value is plugin_path
309  // and plugin_id
310  std::string plugin_dir_;
311  std::string description_;
312  std::string version_;
313  std::string compiler_path_;
315 };
316 
317 } // namespace gs
318 
319 #endif // GRAPHSCOPE_FRAGMENT_SCHEMA_H_
gs::Schema::oe_mutability_
std::map< uint32_t, bool > oe_mutability_
Definition: schema.h:301
gs::Schema::STRING_DEFAULT_MAX_LENGTH
static constexpr const uint16_t STRING_DEFAULT_MAX_LENGTH
Definition: schema.h:49
gs::Schema::add_vertex_label
void add_vertex_label(const std::string &label, const std::vector< PropertyType > &property_types, const std::vector< std::string > &property_names, const std::vector< std::tuple< PropertyType, std::string, size_t >> &primary_key, const std::vector< StorageStrategy > &strategies={}, size_t max_vnum=static_cast< size_t >(1)<< 32, const std::string &description="")
Definition: schema.cc:61
gs::Result
Definition: result.h:62
gs::Schema::BUILTIN_PLUGIN_NUM
static constexpr uint8_t BUILTIN_PLUGIN_NUM
Definition: schema.h:52
gs::Schema::get_sort_on_compaction
bool get_sort_on_compaction(const std::string &src_label, const std::string &dst_label, const std::string &label) const
Definition: schema.cc:347
gs::Schema::version_
std::string version_
Definition: schema.h:312
gs::Schema::has_edge_label
bool has_edge_label(const std::string &src_label, const std::string &dst_label, const std::string &edge_label) const
Definition: schema.cc:1435
gs::Schema::MAX_LENGTH_KEY
static constexpr const char * MAX_LENGTH_KEY
Definition: schema.h:48
gs::Schema::get_edge_label_id
label_t get_edge_label_id(const std::string &label) const
Definition: schema.cc:362
gs::Schema::ie_mutability_
std::map< uint32_t, bool > ie_mutability_
Definition: schema.h:302
gs::Schema::outgoing_edge_mutable
bool outgoing_edge_mutable(const std::string &src_label, const std::string &dst_label, const std::string &label) const
Definition: schema.cc:327
gs::Schema::e_descriptions_
std::map< uint32_t, std::string > e_descriptions_
Definition: schema.h:298
gs::Schema::HQPS_ADHOC_READ_PLUGIN_ID_STR
static constexpr const char * HQPS_ADHOC_READ_PLUGIN_ID_STR
Definition: schema.h:42
gs::EdgeStrategy::kMultiple
@ kMultiple
types.h
gs::Schema::LoadFromYaml
static Result< Schema > LoadFromYaml(const std::string &schema_config)
Definition: schema.cc:1458
gs::Schema::ADHOC_READ_PLUGIN_ID
static constexpr uint8_t ADHOC_READ_PLUGIN_ID
Definition: schema.h:35
gs::Schema::get_outgoing_edge_strategy
EdgeStrategy get_outgoing_edge_strategy(const std::string &src_label, const std::string &dst_label, const std::string &label) const
Definition: schema.cc:307
gs::Schema::vertex_label_to_index
label_t vertex_label_to_index(const std::string &label)
Definition: schema.cc:437
gs::Schema::VARCHAR_KEY
static constexpr const char * VARCHAR_KEY
Definition: schema.h:47
gs::Schema::BUILTIN_COUNT_VERTICES_PLUGIN_ID
static constexpr uint8_t BUILTIN_COUNT_VERTICES_PLUGIN_ID
Definition: schema.h:54
gs::Schema::BUILTIN_TVSP_PLUGIN_ID
static constexpr uint8_t BUILTIN_TVSP_PLUGIN_ID
Definition: schema.h:62
gs::Schema::get_edge_property
PropertyType get_edge_property(label_t src, label_t dst, label_t edge) const
Definition: schema.cc:267
gs::Schema::get_incoming_edge_strategy
EdgeStrategy get_incoming_edge_strategy(const std::string &src_label, const std::string &dst_label, const std::string &label) const
Definition: schema.cc:317
gs::Schema::Deserialize
void Deserialize(std::unique_ptr< grape::LocalIOAdaptor > &reader)
Definition: schema.cc:411
gs::Schema::PRIMITIVE_TYPE_KEY
static constexpr const char * PRIMITIVE_TYPE_KEY
Definition: schema.h:46
gs::Schema::description_
std::string description_
Definition: schema.h:311
gs::Schema::vlabel_indexer_
IdIndexer< std::string, label_t > vlabel_indexer_
Definition: schema.h:287
gs
Definition: adj_list.h:23
gs::Schema::EmplacePlugins
bool EmplacePlugins(const std::vector< std::pair< std::string, std::string >> &plugins)
Definition: schema.cc:1254
gs::Schema::get_edge_description
std::string get_edge_description(const std::string &src_label, const std::string &dst_label, const std::string &label) const
Definition: schema.cc:240
gs::Schema::LoadFromYamlNode
static Result< Schema > LoadFromYamlNode(const YAML::Node &schema_node)
Definition: schema.cc:1473
gs::Schema::get_outgoing_edge_strategy
EdgeStrategy get_outgoing_edge_strategy(label_t src_label, label_t dst_label, label_t label) const
Definition: schema.h:205
gs::Schema::COMPATIBLE_VERSIONS
static const std::vector< std::string > COMPATIBLE_VERSIONS
Definition: schema.h:73
gs::Schema::Serialize
void Serialize(std::unique_ptr< grape::LocalIOAdaptor > &writer) const
Definition: schema.cc:399
gs::Schema::get_vertex_storage_strategies
const std::vector< StorageStrategy > & get_vertex_storage_strategies(const std::string &label) const
Definition: schema.cc:180
gs::Schema::compiler_path_
std::string compiler_path_
Definition: schema.h:313
gs::Schema::set_compiler_path
void set_compiler_path(const std::string &compiler_path)
Definition: schema.cc:35
gs::Schema::oe_strategy_
std::map< uint32_t, EdgeStrategy > oe_strategy_
Definition: schema.h:299
gs::Schema::get_compiler_path
const std::string & get_compiler_path() const
Definition: schema.cc:39
gs::Schema::vertex_has_primary_key
bool vertex_has_primary_key(const std::string &label, const std::string &prop) const
Definition: schema.cc:1397
gs::Schema::RESERVED_PLUGIN_NUM
static constexpr uint8_t RESERVED_PLUGIN_NUM
Definition: schema.h:33
gs::Schema::get_edge_property_names
const std::vector< std::string > & get_edge_property_names(const std::string &src_label, const std::string &dst_label, const std::string &label) const
Definition: schema.cc:273
gs::Schema::get_edge_properties
const std::vector< PropertyType > & get_edge_properties(const std::string &src_label, const std::string &dst_label, const std::string &label) const
Definition: schema.cc:216
gs::Schema::Schema
Schema()
Definition: schema.cc:32
gs::Schema::GetDescription
std::string GetDescription() const
Definition: schema.cc:1374
gs::Schema::max_vnum_
std::vector< size_t > max_vnum_
Definition: schema.h:306
gs::Schema::RemovePlugin
void RemovePlugin(const std::string &plugin_name)
Definition: schema.cc:1368
gs::Schema::BUILTIN_TVSP_PLUGIN_NAME
static constexpr const char * BUILTIN_TVSP_PLUGIN_NAME
Definition: schema.h:63
gs::Schema::BUILTIN_COUNT_VERTICES_PLUGIN_NAME
static constexpr const char * BUILTIN_COUNT_VERTICES_PLUGIN_NAME
Definition: schema.h:55
gs::Schema
Definition: schema.h:29
gs::Schema::valid_edge_property
bool valid_edge_property(const std::string &src_label, const std::string &dst_label, const std::string &label) const
Definition: schema.cc:297
gs::Schema::SetPluginDir
void SetPluginDir(const std::string &plugin_dir)
Definition: schema.cc:1366
gs::Schema::get_vertex_primary_key_name
const std::string & get_vertex_primary_key_name(label_t index) const
gs::Schema::plugin_name_to_path_and_id_
std::unordered_map< std::string, std::pair< std::string, uint8_t > > plugin_name_to_path_and_id_
Definition: schema.h:308
yaml_utils.h
gs::Schema::vertex_label_num
label_t vertex_label_num() const
Definition: schema.cc:110
gs::Schema::BUILTIN_PLUGIN_IDS
static constexpr uint8_t BUILTIN_PLUGIN_IDS[BUILTIN_PLUGIN_NUM]
Definition: schema.h:68
gs::Schema::GetPluginDir
std::string GetPluginDir() const
Definition: schema.cc:1372
gs::Schema::CYPHER_READ_PLUGIN_ID
static constexpr uint8_t CYPHER_READ_PLUGIN_ID
Definition: schema.h:39
gs::Schema::edge_label_num
label_t edge_label_num() const
Definition: schema.cc:114
gs::Schema::BUILTIN_PAGERANK_PLUGIN_ID
static constexpr uint8_t BUILTIN_PAGERANK_PLUGIN_ID
Definition: schema.h:57
gs::IdIndexer< std::string, label_t >
gs::Schema::SetVersion
void SetVersion(const std::string &version)
Definition: schema.cc:1380
result.h
gs::Schema::eprop_names_
std::map< uint32_t, std::vector< std::string > > eprop_names_
Definition: schema.h:297
gs::Schema::set_vertex_properties
void set_vertex_properties(label_t label_id, const std::vector< PropertyType > &types, const std::vector< StorageStrategy > &strategies={})
Definition: schema.cc:130
gs::Schema::get_vertex_label_name
std::string get_vertex_label_name(label_t index) const
Definition: schema.cc:374
gs::Schema::SetDescription
void SetDescription(const std::string &description)
Definition: schema.cc:1376
gs::Schema::GetVersion
std::string GetVersion() const
Definition: schema.cc:1381
gs::Schema::ie_strategy_
std::map< uint32_t, EdgeStrategy > ie_strategy_
Definition: schema.h:300
gs::Schema::has_vertex_label
bool has_vertex_label(const std::string &label) const
Definition: schema.cc:1430
gs::Schema::has_multi_props_edge_
bool has_multi_props_edge_
Definition: schema.h:314
gs::Schema::BUILTIN_K_DEGREE_NEIGHBORS_PLUGIN_ID
static constexpr uint8_t BUILTIN_K_DEGREE_NEIGHBORS_PLUGIN_ID
Definition: schema.h:59
gs::Schema::eproperties_
std::map< uint32_t, std::vector< PropertyType > > eproperties_
Definition: schema.h:296
gs::Schema::BUILTIN_PAGERANK_PLUGIN_NAME
static constexpr const char * BUILTIN_PAGERANK_PLUGIN_NAME
Definition: schema.h:58
gs::Schema::Clear
void Clear()
Definition: schema.cc:41
gs::Schema::get_vertex_description
const std::string & get_vertex_description(const std::string &label) const
Definition: schema.cc:165
gs::Schema::MAX_PLUGIN_ID
static constexpr uint8_t MAX_PLUGIN_ID
Definition: schema.h:34
gs::Schema::label_type
label_t label_type
Definition: schema.h:78
gs::Schema::Equals
bool Equals(const Schema &other) const
Definition: schema.cc:469
id_indexer.h
gs::Schema::HQPS_ADHOC_WRITE_PLUGIN_ID
static constexpr uint8_t HQPS_ADHOC_WRITE_PLUGIN_ID
Definition: schema.h:37
types.h
gs::Schema::plugin_dir_
std::string plugin_dir_
Definition: schema.h:310
gs::Schema::CYPHER_READ_DEBUG_PLUGIN_ID_STR
static constexpr const char * CYPHER_READ_DEBUG_PLUGIN_ID_STR
Definition: schema.h:45
gs::Schema::CYPHER_WRITE_PLUGIN_ID
static constexpr uint8_t CYPHER_WRITE_PLUGIN_ID
Definition: schema.h:40
gs::Schema::get_vertex_property_names
const std::vector< std::string > & get_vertex_property_names(const std::string &label) const
Definition: schema.cc:149
gs::Schema::sort_on_compactions_
std::map< uint32_t, bool > sort_on_compactions_
Definition: schema.h:303
gs::Schema::GetPlugins
const std::unordered_map< std::string, std::pair< std::string, uint8_t > > & GetPlugins() const
Definition: schema.cc:1248
gs::EdgeStrategy
EdgeStrategy
Definition: types.h:24
gs::Schema::get_vertex_properties
const std::vector< PropertyType > & get_vertex_properties(const std::string &label) const
Definition: schema.cc:138
gs::Schema::BUILTIN_PLUGIN_NAMES
static constexpr const char * BUILTIN_PLUGIN_NAMES[BUILTIN_PLUGIN_NUM]
Definition: schema.h:65
gs::Schema::vprop_name_to_type_and_index_
std::vector< std::unordered_map< std::string, std::pair< PropertyType, uint8_t > > > vprop_name_to_type_and_index_
Definition: schema.h:305
gs::Schema::BUILTIN_K_DEGREE_NEIGHBORS_PLUGIN_NAME
static constexpr const char * BUILTIN_K_DEGREE_NEIGHBORS_PLUGIN_NAME
Definition: schema.h:60
gs::Schema::CYPHER_READ_DEBUG_PLUGIN_ID
static constexpr uint8_t CYPHER_READ_DEBUG_PLUGIN_ID
Definition: schema.h:41
gs::Schema::ADHOC_READ_PLUGIN_ID_STR
static constexpr const char * ADHOC_READ_PLUGIN_ID_STR
Definition: schema.h:44
gs::Schema::vertex_has_property
bool vertex_has_property(const std::string &label, const std::string &prop) const
Definition: schema.cc:1386
gs::Schema::get_edge_label_name
std::string get_edge_label_name(label_t index) const
Definition: schema.cc:382
gs::Schema::contains_vertex_label
bool contains_vertex_label(const std::string &label) const
Definition: schema.cc:118
gs::Schema::add_edge_label
void add_edge_label(const std::string &src_label, const std::string &dst_label, const std::string &edge_label, const std::vector< PropertyType > &properties, const std::vector< std::string > &prop_names, EdgeStrategy oe=EdgeStrategy::kMultiple, EdgeStrategy ie=EdgeStrategy::kMultiple, bool oe_mutable=true, bool ie_mutable=true, bool sort_on_compaction=false, const std::string &description="")
Definition: schema.cc:83
gs::Schema::generate_edge_label
uint32_t generate_edge_label(label_t src, label_t dst, label_t edge) const
Definition: schema.cc:458
gs::Schema::get_max_vnum
size_t get_max_vnum(const std::string &label) const
Definition: schema.cc:191
gs::Schema::vproperties_
std::vector< std::vector< PropertyType > > vproperties_
Definition: schema.h:289
gs::Schema::exist
bool exist(const std::string &src_label, const std::string &dst_label, const std::string &edge_label) const
Definition: schema.cc:201
gs::Schema::contains_edge_label
bool contains_edge_label(const std::string &label) const
Definition: schema.cc:369
gs::Schema::DEFAULT_SCHEMA_VERSION
static constexpr const char * DEFAULT_SCHEMA_VERSION
Definition: schema.h:74
gs::Schema::GetCompatibleVersions
static const std::vector< std::string > & GetCompatibleVersions()
Definition: schema.cc:1484
gs::label_t
uint8_t label_t
Definition: types.h:32
gs::Schema::IsBuiltinPlugin
static bool IsBuiltinPlugin(const std::string &plugin_name)
Definition: schema.cc:23
gs::Schema::incoming_edge_mutable
bool incoming_edge_mutable(const std::string &src_label, const std::string &dst_label, const std::string &label) const
Definition: schema.cc:337
gs::Schema::vprop_names_
std::vector< std::vector< std::string > > vprop_names_
Definition: schema.h:290
gs::Schema::get_incoming_edge_strategy
EdgeStrategy get_incoming_edge_strategy(label_t src_label, label_t dst_label, label_t label) const
Definition: schema.h:212
gs::Schema::HQPS_ADHOC_WRITE_PLUGIN_ID_STR
static constexpr const char * HQPS_ADHOC_WRITE_PLUGIN_ID_STR
Definition: schema.h:43
gs::Schema::elabel_indexer_
IdIndexer< std::string, label_t > elabel_indexer_
Definition: schema.h:288
table.h
gs::Schema::~Schema
~Schema()
gs::Schema::edge_label_to_index
label_t edge_label_to_index(const std::string &label)
Definition: schema.cc:452
gs::Schema::vprop_storage_
std::vector< std::vector< StorageStrategy > > vprop_storage_
Definition: schema.h:295
gs::Schema::get_vertex_label_id
label_t get_vertex_label_id(const std::string &label) const
Definition: schema.cc:123
gs::Schema::has_multi_props_edge
bool has_multi_props_edge() const
Definition: schema.cc:1383
gs::Schema::v_descriptions_
std::vector< std::string > v_descriptions_
Definition: schema.h:291
gs::Schema::get_vertex_primary_key
const std::vector< std::tuple< PropertyType, std::string, size_t > > & get_vertex_primary_key(label_t index) const
Definition: schema.cc:391
gs::Schema::get_vprop_name_to_type_and_index
const std::unordered_map< std::string, std::pair< PropertyType, uint8_t > > & get_vprop_name_to_type_and_index(label_t label) const
Definition: schema.cc:197
gs::Schema::v_primary_keys_
std::vector< std::vector< std::tuple< PropertyType, std::string, size_t > > > v_primary_keys_
Definition: schema.h:293
gs::Schema::HQPS_ADHOC_READ_PLUGIN_ID
static constexpr uint8_t HQPS_ADHOC_READ_PLUGIN_ID
Definition: schema.h:36
gs::Schema::edge_has_property
bool edge_has_property(const std::string &src_label, const std::string &dst_label, const std::string &edge_label, const std::string &prop) const
Definition: schema.cc:1411