Skip to main content

selene_core/
lib.rs

1//! Foundation types for the selene-db ISO/IEC 39075:2024 GQL property graph
2//! engine.
3//!
4//! This crate is the dependency root: every other selene crate transitively
5//! depends on it. Per D8, `selene-core` has zero dependencies on other selene
6//! crates. The mandatory data types of ISO GQL minimum conformance live here
7//! (`STRING`, `BOOLEAN`, `INT`, `FLOAT`); composite, temporal, and reference
8//! value types are also normatively defined in Spec 02 and implemented here.
9//! The crate now also carries the composite containers,
10//! schema model, origin metadata, and WAL change payload
11//! types needed by downstream crates.
12//!
13//! See Spec 02 for the full data model specification.
14
15#![forbid(unsafe_code)]
16#![deny(missing_docs)]
17
18mod byte_string_type;
19pub mod cancellation;
20pub mod change_kind;
21pub mod changeset;
22mod changeset_variants;
23mod character_string_type;
24pub mod db_string;
25mod decimal_type;
26mod duration_type;
27pub mod error;
28pub mod extension_type_ids;
29pub mod feature_register;
30pub mod gqlstatus;
31pub mod hlc;
32pub mod identity;
33mod json_patch;
34mod json_value;
35pub mod label_set;
36pub mod metrics;
37pub mod origin;
38pub mod property_map;
39pub mod property_value_type;
40pub mod reserved;
41pub mod schema;
42pub mod value;
43pub mod vector;
44pub mod vector_index;
45
46pub use byte_string_type::{ByteStringType, MAX_BYTE_STRING_TYPE_LENGTH, byte_string_fits_type};
47pub use cancellation::{CancellationCause, CancellationChecker, CancellationToken, NodeScanBudget};
48pub use change_kind::ChangeKind;
49pub use changeset::{
50    Change, LabelDiff, PropertyDiff, SchemaChange, SchemaPropertyIndexKind, SchemaVectorIndexKind,
51};
52pub use character_string_type::{
53    CharacterStringCoercionError, CharacterStringType, MAX_CHARACTER_STRING_TYPE_LENGTH,
54    character_string_fits_type, coerce_character_string_to_type, is_truncating_whitespace,
55};
56pub use db_string::{DbString, db_string};
57pub use decimal_type::{
58    DecimalType, MAX_DECIMAL_PRECISION, MAX_DECIMAL_SCALE, decimal_fits_type, round_decimal_to_type,
59};
60pub use duration_type::{
61    DurationOrderKey, DurationTypeQualifier, DurationValueFamily, duration_order_key,
62    duration_value_family,
63};
64pub use error::{CoreError, CoreResult};
65pub use extension_type_ids::{
66    ExtensionTypeId, FIRST_PARTY_EXTENSION_TYPE_IDS, SELENE_RDF, SELENE_TIMESERIES,
67};
68pub use gqlstatus::{ALL_GQLSTATUS_NAMES, gqlstatus_name};
69pub use hlc::HlcTimestamp;
70pub use identity::{BindingTableId, EdgeId, GraphId, NodeId, RecordTypeId};
71pub use json_value::{JsonPathSelector, JsonValue, JsonValueRef};
72pub use label_set::LabelSet;
73pub use origin::Origin;
74pub use property_map::{PropertyMap, PropertyMapIter, PropertyMapKeys, PropertyMapValues};
75pub use property_value_type::PropertyValueType;
76pub use reserved::RESERVED_LABEL_PREFIX;
77pub use schema::{
78    EdgeEndpointDef, EdgeTypeDef, EdgeTypeDefV1, GraphType, GraphTypeId, KeyLabelSetPolicy,
79    NodeKey, NodeTypeDef, NodeTypeDefV1, NodeTypeRef, PredefinedValueType, PropertyDef,
80    PropertyDefV1, RecordFieldStructure, RecordFieldStructureDef, RecordFieldStructureType,
81    RecordTypeDef, RecordTypeRef, ValidationMode, ValueType, ValueTypeCardinality,
82};
83pub use value::{
84    EdgeDirection, MAX_VECTOR_DIMENSION, Path, PathSegment, Record, RecordTyped, Value, VectorValue,
85};
86pub use vector::{
87    TURBO_QUANT_BLOCK_ROWS, TurboQuantBitWidth, TurboQuantBlockedCodes, TurboQuantCodebook,
88    TurboQuantCodebookKind, TurboQuantCodecError, TurboQuantCodecResult, TurboQuantPackedCodes,
89    VectorMetric, VectorMetricQuery, VectorSearchHit, VectorTopK, exact_vector_top_k,
90    vector_squared_norm,
91};
92pub use vector_index::{HnswIndexConfig, IvfIndexConfig};
93
94#[cfg(test)]
95mod serde_tests;