pub const MAX_WIRE_MESSAGE_BYTES: usize = 16 * 1024 * 1024;
mod arity;
mod auto_literal;
mod cancel;
pub mod ce_messages;
mod convert;
mod convert_walk;
pub mod deadline;
mod dynamic;
mod error;
mod error_kinds;
pub mod file_identity;
pub mod integer_args;
mod list_returns;
mod literal;
mod load_pool;
mod memory_limit;
mod namespace;
mod output_safety;
mod presence_bits;
mod preview;
pub mod temporal;
pub mod tokens;
mod traversal;
mod typename;
mod value;
pub use arity::{
builtin_arity, ArityContract, CHAR_LENGTH_ARITY, FORMAT_ARITY, FUNCTION_REQUIRES_ONE_ARGUMENT,
LENGTH_REQUIRES_A_PATH, NULLIF_ARITY, VECTOR_ARITY,
};
pub use auto_literal::{auto_literal, AutoLiteralGuard};
pub use cancel::CancelToken;
pub use convert::{
column_type_name, cypher_to_value, plan_value_to_cypher, value_to_cypher, MAX_PLAN_WIRE_DEPTH,
};
pub use dynamic::{
dynamic_label_names, dynamic_property_key, DynamicAccessError, DynamicNameToken,
};
pub use error::{
expected_type_detail, invalid_argument_text, negative_page_bound_text,
number_out_of_range_text, uniqueness_violation_detail, ArgumentFault, ArithmeticFailure,
CapacityKind, Error, Result, NEGATIVE_PAGE_BOUND_DETAIL,
};
pub use error_kinds::{
duplicate_variable_detail, undefined_variable_detail, unknown_function_detail, ErrorKind,
TckErrorClass,
};
pub use list_returns::{builtin_returns_list, list_returning_names};
pub use literal::{LiteralValueKind, TOSTRING_TYPE_ERROR_DETAIL};
pub use load_pool::{
current_load_threads, record_transient_lease, resolve_load_threads, run_load_tasks,
with_load_scope, LoadThreads, OpenTransientTracker, TransientLease,
};
pub use memory_limit::{
parse_expression_memory_limit, parse_memory_limit, parse_positive_memory_limit,
require_positive_memory_limit,
};
pub use namespace::{
is_graph_selector_function_name, node_element_id, parse_node_element_id, parse_rel_element_id,
rel_element_id, ElementIdRef, Namespace, GRAPH_SELECTOR_FUNCTIONS,
GRAPH_SELECTOR_FUNCTION_NAMES,
};
pub use output_safety::{escape_unsafe_output, is_unsafe_output_char, quote_message};
pub use presence_bits::PresenceBits;
pub use preview::{
preview_feature_disabled_text, DetectorKind, GateOwner, GateSite, ParseOption, PreviewFeature,
PreviewFeatures, PreviewSource, PreviewSources, PREVIEW_ENV_VAR, PREVIEW_FEATURES,
STORE_CONFIG_FILE,
};
pub use temporal::{QueryClockGuard, Temporal, TransactionClock};
pub use tokens::{ExecutionReceipt, TokenEstimate, TokenOutcome};
pub use traversal::{
require_traversal_depth, traversal_depth_exceeded_message, MAX_TRAVERSAL_DEPTH,
MAX_TRAVERSAL_DEPTH_CEILING,
};
pub use typename::{bare_type_name, expected_value_type_detail, value_type_name};
pub use value::{
bytes_logical_bytes, logical_bytes_within, logical_bytes_within_memo, next_depth,
pack_decoded_values, point_component, str_logical_bytes, tagged_str, uuid_hyphenated,
uuid_parse, value_depth_exceeded, ExpansionMemo, Node, Path, PointValue, PropertyMap,
Relationship, TaggedStr, Value, VectorCoordKind, MAX_VALUE_DEPTH,
};
pub type NodeId = i64;
pub type RelId = i64;
pub const fn is_virtual_id(id: i64) -> bool {
id < 0
}
pub fn validate_persisted_id(id: i64, what: &str) -> Result<()> {
if id < 0 || id == i64::MAX {
return Err(Error::storage(format!(
"{what} ID {id} is outside 0..i64::MAX"
)));
}
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn persisted_id_predicate_accepts_in_range_and_rejects_zero_nine_six() {
for id in [0, 1, 42, i64::MAX - 1] {
validate_persisted_id(id, "node").unwrap();
}
for id in [-1, i64::MIN, i64::MAX] {
let error = validate_persisted_id(id, "node").unwrap_err();
assert!(matches!(error, Error::Storage(_)), "{error}");
assert_eq!(
error.to_string(),
format!("storage error: node ID {id} is outside 0..i64::MAX")
);
}
}
}