1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) 2026 Austin Han <austinhan1024@gmail.com>
//
// This file is part of RocksGraph.
//
// RocksGraph is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// RocksGraph is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RocksGraph. If not, see <https://www.gnu.org/licenses/>.
//! [`PropKey`] — the property key type — and the built-in reserved keys.
//!
//! Property keys are plain strings (e.g. `"name"`, `"age"`). They are represented
//! as [`SmolStr`], which stack-allocates strings up to 23 bytes and avoids heap
//! allocation for the vast majority of real-world keys.
//!
//! # Built-in keys
//!
//! Three keys are reserved and synthesized on-the-fly by [`Vertex`](crate::types::Vertex)
//! and [`Edge`](crate::types::Edge) rather than stored in `props`:
//!
//! - [`ID`] (`"id"`) — the element's numeric identifier ([`VertexKey`](crate::types::VertexKey)).
//! Vertices only; edges are identified by their composite key instead.
//! - [`LABEL`] (`"label"`) — the element's label as its numeric [`LabelId`](crate::types::LabelId).
//! Both vertices and edges.
//! - [`RANK`] (`"rank"`) — disambiguates parallel edges with the same label between the
//! same two vertices (multi-edge mode). Edges only.
//!
//! Querying these keys via `get_property` / `get_value` always succeeds without a
//! `props` scan.
use SmolStr;
/// Name of a property key.
///
/// Stack-allocated for strings up to 23 bytes; heap-allocated only for
/// unusually long key names. No interning or numeric mapping — the raw
/// string is the identity.
pub type PropKey = SmolStr;
pub const ID: PropKey = new_static;
pub const LABEL: PropKey = new_static;
pub const RANK: PropKey = new_static;
// Property-key and label ids never assign 0 — it's reserved crate-internally to mean "no such
// key/label" (see `schema::definition::MAX_PROP_KEYS`), so real ids start at 1.
pub const ID_KEY_ID: u16 = 1;
pub const LABEL_KEY_ID: u16 = 2;
pub const RANK_KEY_ID: u16 = 3;