1pub const MAX_WIRE_MESSAGE_BYTES: usize = 16 * 1024 * 1024;
8
9mod arity;
10mod auto_literal;
11mod cancel;
12pub mod ce_messages;
13mod convert;
14mod convert_walk;
15mod dynamic;
16mod error;
17mod error_kinds;
22pub mod file_identity;
23pub mod integer_args;
24mod literal;
25mod load_pool;
26mod memory_limit;
27mod namespace;
28mod output_safety;
29mod presence_bits;
30mod preview;
31pub mod temporal;
32pub mod tokens;
33mod traversal;
34mod typename;
35mod value;
36
37pub use arity::{
38 builtin_arity, ArityContract, CHAR_LENGTH_ARITY, FORMAT_ARITY, FUNCTION_REQUIRES_ONE_ARGUMENT,
39 LENGTH_REQUIRES_A_PATH, NULLIF_ARITY, VECTOR_ARITY,
40};
41pub use auto_literal::{auto_literal, AutoLiteralGuard};
42pub use cancel::CancelToken;
43pub use convert::{
44 column_type_name, cypher_to_value, plan_value_to_cypher, value_to_cypher, MAX_PLAN_WIRE_DEPTH,
45};
46pub use dynamic::{
47 dynamic_label_names, dynamic_property_key, DynamicAccessError, DynamicNameToken,
48};
49pub use error::{
50 expected_type_detail, negative_page_bound_text, uniqueness_violation_detail, ArgumentFault,
51 ArithmeticFailure, CapacityKind, Error, Result, NEGATIVE_PAGE_BOUND_DETAIL,
52};
53pub use error_kinds::{
54 duplicate_variable_detail, undefined_variable_detail, unknown_function_detail, ErrorKind,
55 TckErrorClass,
56};
57pub use literal::{
58 homogeneous_element_class, LiteralElementClass, LiteralValueKind, TOSTRING_TYPE_ERROR_DETAIL,
59};
60pub use load_pool::{
61 current_load_threads, record_transient_lease, resolve_load_threads, run_load_tasks,
62 with_load_scope, LoadThreads, OpenTransientTracker, TransientLease,
63};
64pub use memory_limit::{
65 parse_expression_memory_limit, parse_memory_limit, parse_positive_memory_limit,
66 require_positive_memory_limit,
67};
68pub use namespace::{
69 is_graph_selector_function_name, node_element_id, parse_node_element_id, parse_rel_element_id,
70 rel_element_id, ElementIdRef, Namespace, GRAPH_SELECTOR_FUNCTIONS,
71 GRAPH_SELECTOR_FUNCTION_NAMES,
72};
73pub use output_safety::is_unsafe_output_char;
74pub use presence_bits::PresenceBits;
75pub use preview::{
76 preview_feature_disabled_text, DetectorKind, GateSite, ParseOption, PreviewFeature,
77 PreviewFeatures, PREVIEW_FEATURES,
78};
79pub use temporal::{QueryClockGuard, Temporal, TransactionClock};
80pub use tokens::{ExecutionReceipt, TokenEstimate, TokenOutcome};
81pub use traversal::{
82 require_traversal_depth, traversal_depth_exceeded_message, MAX_TRAVERSAL_DEPTH,
83 MAX_TRAVERSAL_DEPTH_CEILING,
84};
85pub use typename::{bare_type_name, expected_value_type_detail, value_type_name};
86pub use value::{
87 bytes_logical_bytes, logical_bytes_within, next_depth, point_component, str_logical_bytes,
88 tagged_str, uuid_hyphenated, uuid_parse, value_depth_exceeded, Node, Path, PointValue,
89 PropertyMap, Relationship, TaggedStr, Value, VectorCoordKind, MAX_VALUE_DEPTH,
90};
91
92pub type NodeId = i64;
93pub type RelId = i64;
94
95pub const fn is_virtual_id(id: i64) -> bool {
100 id < 0
101}
102
103pub fn validate_persisted_id(id: i64, what: &str) -> Result<()> {
110 if id < 0 || id == i64::MAX {
111 return Err(Error::storage(format!(
112 "{what} ID {id} is outside 0..i64::MAX"
113 )));
114 }
115 Ok(())
116}
117
118#[cfg(test)]
119mod tests {
120 use super::*;
121
122 #[test]
123 fn persisted_id_predicate_accepts_in_range_and_rejects_zero_nine_six() {
124 for id in [0, 1, 42, i64::MAX - 1] {
125 validate_persisted_id(id, "node").unwrap();
126 }
127 for id in [-1, i64::MIN, i64::MAX] {
128 let error = validate_persisted_id(id, "node").unwrap_err();
129 assert!(matches!(error, Error::Storage(_)), "{error}");
130 assert_eq!(
131 error.to_string(),
132 format!("storage error: node ID {id} is outside 0..i64::MAX")
133 );
134 }
135 }
136}