pub struct NodeState<'provider> { /* private fields */ }Expand description
A node of the content tree, addressed by its node record.
Implementations§
Source§impl<'provider> NodeState<'provider>
impl<'provider> NodeState<'provider>
Sourcepub fn new(
provider: &'provider dyn SegmentProvider,
record_identifier: RecordIdentifier,
) -> Self
pub fn new( provider: &'provider dyn SegmentProvider, record_identifier: RecordIdentifier, ) -> Self
Creates a node state for the node record at record_identifier.
Sourcepub fn record_identifier(&self) -> RecordIdentifier
pub fn record_identifier(&self) -> RecordIdentifier
The node record this state reads from.
Sourcepub fn stable_identifier(&self) -> Result<String>
pub fn stable_identifier(&self) -> Result<String>
The node’s stable identifier: <segment UUID>:<record number>.
The stable identifier survives compaction: slot 0 either marks the node itself (a self-reference) or points at a 20-byte block holding the identifier of the original node record before compaction rewrote it.
Sourcepub fn stable_identifier_bytes(&self) -> Result<[u8; 20]>
pub fn stable_identifier_bytes(&self) -> Result<[u8; 20]>
The node’s 20-byte stable identifier: the serialized (msb, lsb,
record number) of the record its identity descends from. When slot 0
is a self reference, this is the node’s own record identifier
serialized. Rewriters propagate these bytes so a node keeps its
identity across compaction.
Sourcepub fn child_node_count(&self) -> Result<u64>
pub fn child_node_count(&self) -> Result<u64>
The number of child nodes.
Sourcepub fn child_node(&self, name: &str) -> Result<Option<NodeState<'provider>>>
pub fn child_node(&self, name: &str) -> Result<Option<NodeState<'provider>>>
Looks up a child node by name.
Sourcepub fn child_node_entries(&self) -> Result<Vec<(String, NodeState<'provider>)>>
pub fn child_node_entries(&self) -> Result<Vec<(String, NodeState<'provider>)>>
All child nodes with their names, in storage order.
Sourcepub fn properties(&self) -> Result<Vec<PropertyState>>
pub fn properties(&self) -> Result<Vec<PropertyState>>
All properties, in template order, with jcr:primaryType and
jcr:mixinTypes synthesized from the template head first — the
same view Oak’s node state API presents.
Sourcepub fn stored_properties(&self) -> Result<Vec<PropertyState>>
pub fn stored_properties(&self) -> Result<Vec<PropertyState>>
The node’s stored properties, in template order, without the
synthesized jcr:primaryType and jcr:mixinTypes. Rewriting a node
must use this together with the template’s primary type and mixin
types, never Self::properties filtered by name — a property
literally named jcr:primaryType of a non-name type is a real
stored property and would otherwise be lost.
Sourcepub fn property(&self, name: &str) -> Result<Option<PropertyState>>
pub fn property(&self, name: &str) -> Result<Option<PropertyState>>
Looks up a property by name, including the synthesized
jcr:primaryType and jcr:mixinTypes.
When the template head carries no synthetic entry for those names,
the lookup falls through to the ordinary property list: a property
literally named jcr:primaryType whose type is not a single NAME
is stored as an ordinary property, and Java returns it.