Skip to content

Commit f506b24

Browse files
authored
refactor: refactors the graph schema modification interfaces (#289)
1 parent fb5366d commit f506b24

23 files changed

Lines changed: 1563 additions & 977 deletions

include/neug/storages/graph/graph_interface.h

Lines changed: 33 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -554,55 +554,29 @@ class StorageUpdateInterface : public StorageReadInterface,
554554
const std::vector<std::pair<vid_t, int32_t>>& oe_edges,
555555
const std::vector<std::pair<vid_t, int32_t>>& ie_edges) = 0;
556556

557-
virtual Status CreateVertexType(
558-
const std::string& name,
559-
const std::vector<std::tuple<DataType, std::string, Property>>&
560-
properties,
561-
const std::vector<std::string>& primary_key_names,
562-
bool error_on_conflict) = 0;
563-
564-
virtual Status CreateEdgeType(
565-
const std::string& src_type, const std::string& dst_type,
566-
const std::string& edge_type,
567-
const std::vector<std::tuple<DataType, std::string, Property>>&
568-
properties,
569-
bool error_on_conflict, EdgeStrategy oe_edge_strategy,
570-
EdgeStrategy ie_edge_strategy) = 0;
571-
572-
virtual Status AddVertexProperties(
573-
const std::string& vertex_type_name,
574-
const std::vector<std::tuple<DataType, std::string, Property>>&
575-
add_properties,
576-
bool error_on_conflict) = 0;
577-
578-
virtual Status AddEdgeProperties(
579-
const std::string& src_type, const std::string& dst_type,
580-
const std::string& edge_type,
581-
const std::vector<std::tuple<DataType, std::string, Property>>&
582-
add_properties,
583-
bool error_on_conflict) = 0;
557+
virtual Status CreateVertexType(const CreateVertexTypeParam& config,
558+
bool error_on_conflict) = 0;
559+
560+
virtual Status CreateEdgeType(const CreateEdgeTypeParam& config,
561+
bool error_on_conflict) = 0;
562+
563+
virtual Status AddVertexProperties(const AddVertexPropertiesParam& config,
564+
bool error_on_conflict) = 0;
565+
566+
virtual Status AddEdgeProperties(const AddEdgePropertiesParam& config,
567+
bool error_on_conflict) = 0;
584568

585569
virtual Status RenameVertexProperties(
586-
const std::string& vertex_type_name,
587-
const std::vector<std::pair<std::string, std::string>>& rename_properties,
588-
bool error_on_conflict) = 0;
570+
const RenameVertexPropertiesParam& config, bool error_on_conflict) = 0;
589571

590-
virtual Status RenameEdgeProperties(
591-
const std::string& src_type, const std::string& dst_type,
592-
const std::string& edge_type,
593-
const std::vector<std::pair<std::string, std::string>>& rename_properties,
594-
bool error_on_conflict) = 0;
572+
virtual Status RenameEdgeProperties(const RenameEdgePropertiesParam& config,
573+
bool error_on_conflict) = 0;
595574

596575
virtual Status DeleteVertexProperties(
597-
const std::string& vertex_type_name,
598-
const std::vector<std::string>& delete_properties,
599-
bool error_on_conflict) = 0;
576+
const DeleteVertexPropertiesParam& config, bool error_on_conflict) = 0;
600577

601-
virtual Status DeleteEdgeProperties(
602-
const std::string& src_type, const std::string& dst_type,
603-
const std::string& edge_type,
604-
const std::vector<std::string>& delete_properties,
605-
bool error_on_conflict) = 0;
578+
virtual Status DeleteEdgeProperties(const DeleteEdgePropertiesParam& config,
579+
bool error_on_conflict) = 0;
606580

607581
virtual Status DeleteVertexType(const std::string& vertex_type_name,
608582
bool error_on_conflict = true) = 0;
@@ -651,47 +625,22 @@ class StorageAPUpdateInterface : public StorageUpdateInterface {
651625
label_t src_v_label_id, label_t dst_v_label_id, label_t edge_label_id,
652626
const std::vector<std::pair<vid_t, int32_t>>& oe_edges,
653627
const std::vector<std::pair<vid_t, int32_t>>& ie_edges) override;
654-
Status CreateVertexType(
655-
const std::string& name,
656-
const std::vector<std::tuple<DataType, std::string, Property>>&
657-
properties,
658-
const std::vector<std::string>& primary_key_names,
659-
bool error_on_conflict) override;
660-
Status CreateEdgeType(
661-
const std::string& src_type, const std::string& dst_type,
662-
const std::string& edge_type,
663-
const std::vector<std::tuple<DataType, std::string, Property>>&
664-
properties,
665-
bool error_on_conflict, EdgeStrategy oe_edge_strategy,
666-
EdgeStrategy ie_edge_strategy) override;
667-
Status AddVertexProperties(
668-
const std::string& vertex_type_name,
669-
const std::vector<std::tuple<DataType, std::string, Property>>&
670-
add_properties,
671-
bool error_on_conflict) override;
672-
Status AddEdgeProperties(
673-
const std::string& src_type, const std::string& dst_type,
674-
const std::string& edge_type,
675-
const std::vector<std::tuple<DataType, std::string, Property>>&
676-
add_properties,
677-
bool error_on_conflict) override;
678-
Status RenameVertexProperties(
679-
const std::string& vertex_type_name,
680-
const std::vector<std::pair<std::string, std::string>>& rename_properties,
681-
bool error_on_conflict) override;
682-
Status RenameEdgeProperties(
683-
const std::string& src_type, const std::string& dst_type,
684-
const std::string& edge_type,
685-
const std::vector<std::pair<std::string, std::string>>& rename_properties,
686-
bool error_on_conflict) override;
687-
Status DeleteVertexProperties(
688-
const std::string& vertex_type_name,
689-
const std::vector<std::string>& delete_properties,
690-
bool error_on_conflict) override;
691-
Status DeleteEdgeProperties(const std::string& src_type,
692-
const std::string& dst_type,
693-
const std::string& edge_type,
694-
const std::vector<std::string>& delete_properties,
628+
Status CreateVertexType(const CreateVertexTypeParam& config,
629+
bool error_on_conflict = true) override;
630+
631+
Status CreateEdgeType(const CreateEdgeTypeParam& config,
632+
bool error_on_conflict) override;
633+
Status AddVertexProperties(const AddVertexPropertiesParam& config,
634+
bool error_on_conflict) override;
635+
Status AddEdgeProperties(const AddEdgePropertiesParam& config,
636+
bool error_on_conflict) override;
637+
Status RenameVertexProperties(const RenameVertexPropertiesParam& config,
638+
bool error_on_conflict) override;
639+
Status RenameEdgeProperties(const RenameEdgePropertiesParam& config,
640+
bool error_on_conflict) override;
641+
Status DeleteVertexProperties(const DeleteVertexPropertiesParam& config,
642+
bool error_on_conflict) override;
643+
Status DeleteEdgeProperties(const DeleteEdgePropertiesParam& config,
695644
bool error_on_conflict) override;
696645
Status DeleteVertexType(const std::string& vertex_type_name,
697646
bool error_on_conflict = true) override;

0 commit comments

Comments
 (0)