1414 */
1515#pragma once
1616
17+ #include < optional>
1718#include " neug/storages/graph/property_graph.h"
1819#include " neug/storages/graph/schema.h"
1920#include " neug/utils/property/types.h"
@@ -365,8 +366,9 @@ class StorageReadInterface : virtual public IStorageInterface {
365366 * inserter.AddVertex(person_label, Property("alice"), props, vid);
366367 *
367368 * // Add edge between vertices
369+ * const void* edge_prop = nullptr;
368370 * inserter.AddEdge(person_label, src_vid, person_label, dst_vid, knows_label,
369- * {} );
371+ * {}, edge_prop );
370372 * @endcode
371373 *
372374 * @note This interface is write-only; use StorageReadInterface for reads.
@@ -391,11 +393,12 @@ class StorageInsertInterface : virtual public IStorageInterface {
391393 * @param label Vertex label
392394 * @param id Primary key value
393395 * @param props Property values (excluding primary key)
394- * @param vid Output: assigned internal vertex ID
395- * @return true if vertex added successfully
396+ * @param vid Output: assigned internal vertex ID on success
397+ * @return Status::OK() on success, or an error Status if validation fails
398+ * (e.g. property count/type mismatch, capacity failure).
396399 */
397- virtual bool AddVertex (label_t label, const Property& id,
398- const std::vector<Property>& props, vid_t & vid) = 0;
400+ virtual Status AddVertex (label_t label, const Property& id,
401+ const std::vector<Property>& props, vid_t & vid) = 0;
399402
400403 /* *
401404 * @brief Add a single edge to the graph.
@@ -406,11 +409,16 @@ class StorageInsertInterface : virtual public IStorageInterface {
406409 * @param dst Destination vertex internal ID
407410 * @param edge_label Edge label
408411 * @param properties Edge property values
409- * @return true if edge added successfully
412+ * @param prop Output: pointer to the inserted edge property storage. For an
413+ * insert transaction the edge property is not actually inserted
414+ * into the graph until commit, so this is set to nullptr.
415+ * @return Status::OK() on success, or an error Status if validation fails
416+ * (e.g. missing source/destination vertex, property mismatch).
410417 */
411- virtual bool AddEdge (label_t src_label, vid_t src, label_t dst_label,
412- vid_t dst, label_t edge_label,
413- const std::vector<Property>& properties) = 0;
418+ virtual Status AddEdge (label_t src_label, vid_t src, label_t dst_label,
419+ vid_t dst, label_t edge_label,
420+ const std::vector<Property>& properties,
421+ const void *& prop) = 0;
414422
415423 /* *
416424 * @brief Batch insert vertices from a record supplier.
@@ -517,12 +525,13 @@ class StorageUpdateInterface : public StorageReadInterface,
517525 int32_t ie_offset, int32_t col_id,
518526 const Property& value) = 0;
519527
520- virtual bool AddVertex (label_t label, const Property& id,
521- const std::vector<Property>& props,
522- vid_t & vid) override = 0;
523- virtual bool AddEdge (label_t src_label, vid_t src, label_t dst_label,
524- vid_t dst, label_t edge_label,
525- const std::vector<Property>& properties) override = 0;
528+ virtual Status AddVertex (label_t label, const Property& id,
529+ const std::vector<Property>& props,
530+ vid_t & vid) override = 0;
531+ virtual Status AddEdge (label_t src_label, vid_t src, label_t dst_label,
532+ vid_t dst, label_t edge_label,
533+ const std::vector<Property>& properties,
534+ const void *& prop) override = 0;
526535
527536 /* *
528537 * @brief Delete multiple vertices by their internal IDs.
@@ -599,11 +608,11 @@ class StorageAPUpdateInterface : public StorageUpdateInterface {
599608 vid_t dst, label_t edge_label, int32_t oe_offset,
600609 int32_t ie_offset, int32_t col_id,
601610 const Property& value) override ;
602- bool AddVertex (label_t label, const Property& id,
603- const std::vector<Property>& props, vid_t & vid) override ;
604- bool AddEdge (label_t src_label, vid_t src, label_t dst_label, vid_t dst,
605- label_t edge_label,
606- const std::vector<Property>& properties ) override ;
611+ Status AddVertex (label_t label, const Property& id,
612+ const std::vector<Property>& props, vid_t & vid) override ;
613+ Status AddEdge (label_t src_label, vid_t src, label_t dst_label, vid_t dst,
614+ label_t edge_label, const std::vector<Property>& properties ,
615+ const void *& prop ) override ;
607616 void CreateCheckpoint () override ;
608617 Status BatchAddVertices (
609618 label_t v_label_id,
0 commit comments