pub struct SurfaceNode {
pub container: Container<Uuid, Address>,
pub images: BTreeMap<ImageRole, ImageRef>,
}Expand description
A browsing surface in the kernel’s surface stratum.
The only physical residue outside Container is the D0 image-reference map. Those small, content-addressed experience handles stay here so paint can resolve them without consulting a metadata facet; pixels remain out of line.
Fields§
§container: Container<Uuid, Address>The one node substrate. Identity, primary-first addresses, authored content, media type, title, tags, and nested-graph bearing live here.
Deref keeps the Container capability surface direct.
images: BTreeMap<ImageRole, ImageRef>Content-addressed preview imagery, keyed by role. The node carries
~40-byte ImageRef handles; the pixels live in the durable blob
store under content/image/<hex> (see
pandect::image_store).
This is the node-image externalization plan’s phase 2. Inline
thumbnail_png / favicon_rgba bytes used to ride here and dominated
the graph: at 50k nodes they were 64% of live heap, and the lane-D gate
measured them at 18x the snapshot size and 3.8x its load time. A
preview is experience, not truth, so it belongs in a bounded,
collectable cache rather than in every node forever.
Read through Node::image / Node::favicon / Node::preview
rather than indexing the map, so call sites name a role.
Implementations§
Source§impl SurfaceNode
impl SurfaceNode
Sourcepub fn image(&self, role: ImageRole) -> Option<&ImageRef>
pub fn image(&self, role: ImageRole) -> Option<&ImageRef>
The image reference held for role, if any.
Sourcepub fn preview(&self) -> Option<&ImageRef>
pub fn preview(&self) -> Option<&ImageRef>
The preview reference, if one has been stored. This is the role the
legacy inline thumbnail_png migrates into.
Sourcepub fn set_image(
&mut self,
role: ImageRole,
image: ImageRef,
) -> Option<ImageRef>
pub fn set_image( &mut self, role: ImageRole, image: ImageRef, ) -> Option<ImageRef>
Attach (or replace) the reference for role, returning any prior one.
The pixels must already be in the blob store; the node only carries
the handle.
Sourcepub fn clear_image(&mut self, role: ImageRole) -> Option<ImageRef>
pub fn clear_image(&mut self, role: ImageRole) -> Option<ImageRef>
Drop the reference for role, returning it. The blob itself is left
for the orphan-GC pass, per the manifest-deletion doctrine: dropping a
reference is not a delete.
Sourcepub fn primary_address(&self) -> &Address
pub fn primary_address(&self) -> &Address
Returns the node’s canonical retrieval address (the first address).
Sourcepub fn url(&self) -> &str
pub fn url(&self) -> &str
Returns the canonical retrieval URL string. Convenience over
Node::primary_address.
pub fn test_stub(url: &str) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SurfaceNode
impl RefUnwindSafe for SurfaceNode
impl Send for SurfaceNode
impl Sync for SurfaceNode
impl Unpin for SurfaceNode
impl UnsafeUnpin for SurfaceNode
impl UnwindSafe for SurfaceNode
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.