Skip to content

Commit d964311

Browse files
committed
add error_code to rust codegen
1 parent 29b6e7f commit d964311

File tree

3 files changed

+40
-11
lines changed

3 files changed

+40
-11
lines changed

modules/graph/grin/rust/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
authors = ["dijie"]
55

66
[features]
7-
default = ["grin_assume_has_directed_graph", "grin_assume_has_undirected_graph", "grin_assume_has_multi_edge_graph", "grin_with_vertex_original_id", "grin_enable_vertex_list", "grin_enable_vertex_list_array", "grin_enable_vertex_list_iterator", "grin_enable_adjacent_list", "grin_enable_adjacent_list_array", "grin_enable_adjacent_list_iterator", "grin_enable_graph_partition", "grin_trait_natural_id_for_partition", "grin_enable_vertex_ref", "grin_assume_edge_cut_partition", "grin_trait_select_master_for_vertex_list", "grin_enable_row", "grin_with_vertex_property", "grin_with_vertex_property_name", "grin_with_vertex_type_name", "grin_trait_natural_id_for_vertex_type", "grin_enable_vertex_property_table", "grin_enable_vertex_primary_keys", "grin_trait_natural_id_for_vertex_property", "grin_assume_by_type_vertex_original_id", "grin_with_edge_property", "grin_with_edge_property_name", "grin_with_edge_type_name", "grin_trait_natural_id_for_edge_type", "grin_enable_edge_property_table", "grin_trait_natural_id_for_edge_property", "grin_trait_select_type_for_vertex_list", "grin_trait_select_edge_type_for_adjacent_list", "grin_assume_column_store_for_vertex_property", "grin_assume_column_store_for_edge_property", "grin_assume_all_vertex_list_sorted"]
7+
default = ["grin_assume_has_directed_graph", "grin_assume_has_undirected_graph", "grin_assume_has_multi_edge_graph", "grin_with_vertex_original_id", "grin_enable_vertex_list", "grin_enable_vertex_list_array", "grin_enable_vertex_list_iterator", "grin_enable_adjacent_list", "grin_enable_adjacent_list_array", "grin_enable_adjacent_list_iterator", "grin_enable_graph_partition", "grin_trait_natural_id_for_partition", "grin_enable_vertex_ref", "grin_trait_fast_vertex_ref", "grin_assume_edge_cut_partition", "grin_trait_select_master_for_vertex_list", "grin_enable_row", "grin_with_vertex_property", "grin_with_vertex_property_name", "grin_with_vertex_type_name", "grin_trait_natural_id_for_vertex_type", "grin_enable_vertex_property_table", "grin_enable_vertex_primary_keys", "grin_trait_natural_id_for_vertex_property", "grin_assume_by_type_vertex_original_id", "grin_with_edge_property", "grin_with_edge_property_name", "grin_with_edge_type_name", "grin_trait_natural_id_for_edge_type", "grin_enable_edge_property_table", "grin_trait_natural_id_for_edge_property", "grin_trait_select_type_for_vertex_list", "grin_trait_select_edge_type_for_adjacent_list", "grin_assume_column_store_for_vertex_property", "grin_assume_column_store_for_edge_property", "grin_assume_all_vertex_list_sorted"]
88
grin_assume_has_directed_graph = []
99
grin_assume_has_undirected_graph = []
1010
grin_assume_has_multi_edge_graph = []
@@ -23,6 +23,7 @@ grin_enable_adjacent_list_iterator = []
2323
grin_enable_graph_partition = []
2424
grin_trait_natural_id_for_partition = []
2525
grin_enable_vertex_ref = []
26+
grin_trait_fast_vertex_ref = []
2627
grin_enable_edge_ref = []
2728
grin_assume_all_replicate_partition = ["grin_assume_replicate_master_mirror_partition_for_vertex_data", "grin_assume_replicate_master_mirror_partition_for_edge_data", "grin_assume_replicate_master_mirror_partition_for_vertex_property", "grin_assume_replicate_master_mirror_partition_for_edge_property"]
2829
grin_assume_edge_cut_partition = ["grin_assume_master_only_partition_for_vertex_data", "grin_assume_replicate_master_mirror_partition_for_edge_data", "grin_assume_master_only_partition_for_vertex_property", "grin_assume_replicate_master_mirror_partition_for_edge_property"]

modules/graph/grin/rust/grin_v6d.rs

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
#[doc = "< incoming"]
23
pub const GRIN_DIRECTION_IN: GrinDirection = 0;
34
#[doc = "< outgoing"]
@@ -22,12 +23,24 @@ pub const GRIN_DATATYPE_FLOAT: GrinDatatype = 5;
2223
pub const GRIN_DATATYPE_DOUBLE: GrinDatatype = 6;
2324
#[doc = "< string"]
2425
pub const GRIN_DATATYPE_STRING: GrinDatatype = 7;
25-
#[doc = "< short date"]
26+
#[doc = "< date"]
2627
pub const GRIN_DATATYPE_DATE32: GrinDatatype = 8;
27-
#[doc = "< long date"]
28-
pub const GRIN_DATATYPE_DATE64: GrinDatatype = 9;
28+
#[doc = "< Time32"]
29+
pub const GRIN_DATATYPE_TIME32: GrinDatatype = 9;
30+
#[doc = "< Timestamp"]
31+
pub const GRIN_DATATYPE_TIMESTAMP64: GrinDatatype = 10;
2932
#[doc = " Enumerates the datatype supported in the storage"]
3033
pub type GrinDatatype = u32;
34+
#[doc = "< success"]
35+
pub const GrinErrorCodeGrinNoError: GrinErrorCode = 0;
36+
#[doc = "< unknown error"]
37+
pub const GrinErrorCodeGrinUnknownError: GrinErrorCode = 1;
38+
#[doc = "< invalid value"]
39+
pub const GrinErrorCodeGrinInvalidValue: GrinErrorCode = 2;
40+
#[doc = "< unknown datatype"]
41+
pub const GrinErrorCodeGrinUnknownDatatype: GrinErrorCode = 3;
42+
#[doc = " Enumerates the error codes of grin"]
43+
pub type GrinErrorCode = u32;
3144
#[doc = "@}"]
3245
pub type GrinGraph = *mut ::std::os::raw::c_void;
3346
pub type GrinVertex = *mut ::std::os::raw::c_void;
@@ -38,22 +51,22 @@ pub type GrinVertexListIterator = *mut ::std::os::raw::c_void;
3851
pub type GrinAdjacentList = *mut ::std::os::raw::c_void;
3952
pub type GrinAdjacentListIterator = *mut ::std::os::raw::c_void;
4053
pub type GrinPartitionedGraph = *mut ::std::os::raw::c_void;
41-
pub type GrinPartition = *mut ::std::os::raw::c_void;
54+
pub type GrinPartition = u32;
4255
pub type GrinPartitionList = *mut ::std::os::raw::c_void;
4356
pub type GrinPartitionId = u32;
44-
pub type GrinVertexRef = *mut ::std::os::raw::c_void;
45-
pub type GrinVertexType = *mut ::std::os::raw::c_void;
57+
pub type GrinVertexRef = i64;
58+
pub type GrinVertexType = u32;
4659
pub type GrinVertexTypeList = *mut ::std::os::raw::c_void;
47-
pub type GrinVertexProperty = *mut ::std::os::raw::c_void;
60+
pub type GrinVertexProperty = u64;
4861
pub type GrinVertexPropertyList = *mut ::std::os::raw::c_void;
4962
pub type GrinVertexPropertyTable = *mut ::std::os::raw::c_void;
5063
pub type GrinVertexTypeId = u32;
5164
pub type GrinVertexPropertyId = u32;
52-
pub type GrinEdgeType = *mut ::std::os::raw::c_void;
65+
pub type GrinEdgeType = u32;
5366
pub type GrinEdgeTypeList = *mut ::std::os::raw::c_void;
5467
pub type GrinVevType = *mut ::std::os::raw::c_void;
5568
pub type GrinVevTypeList = *mut ::std::os::raw::c_void;
56-
pub type GrinEdgeProperty = *mut ::std::os::raw::c_void;
69+
pub type GrinEdgeProperty = u64;
5770
pub type GrinEdgePropertyList = *mut ::std::os::raw::c_void;
5871
pub type GrinEdgePropertyTable = *mut ::std::os::raw::c_void;
5972
pub type GrinEdgeTypeId = u32;
@@ -314,6 +327,17 @@ extern "C" {
314327
#[cfg(feature = "grin_enable_vertex_ref")]
315328
pub fn grin_is_mirror_vertex(arg1: GrinGraph, arg2: GrinVertex) -> bool;
316329

330+
pub fn grin_serialize_vertex_ref_as_int64(
331+
arg1: GrinGraph,
332+
arg2: GrinVertexRef,
333+
) -> i64;
334+
335+
#[cfg(feature = "grin_trait_fast_vertex_ref")]
336+
pub fn grin_deserialize_vertex_ref_from_int64(
337+
arg1: GrinGraph,
338+
arg2: i64,
339+
) -> GrinVertexRef;
340+
317341
#[cfg(feature = "grin_enable_graph_partition")]
318342
pub fn grin_get_total_vertex_num(arg1: GrinPartitionedGraph) -> usize;
319343

@@ -1066,4 +1090,6 @@ extern "C" {
10661090
arg2: GrinVertexList,
10671091
arg3: GrinVertex,
10681092
) -> usize;
1093+
1094+
pub static mut grin_error_code: GrinErrorCode;
10691095
}

modules/graph/grin/rust/v6d_all.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313
#include "../include/property/topology.h"
1414
#include "../include/property/type.h"
1515
#include "../include/index/label.h"
16-
#include "../include/index/order.h"
16+
#include "../include/index/order.h"
17+
18+
__thread GRIN_ERROR_CODE grin_error_code;

0 commit comments

Comments
 (0)