Skip to main content

visible_paths

Function visible_paths 

Source
pub fn visible_paths<'a, P: PeerId>(
    publications: impl IntoIterator<Item = (&'a str, &'a AudienceKind<P>)>,
    grant: &Grant,
    viewer: Viewer<'_, P>,
) -> Prefixes
Expand description

Returns the paths of publications that viewer may see, as prefixes.

A publication is visible when the link’s grant covers its path and its audience admits the link. A media relay sees Granted publications, and never a Peers one, which a media relay would forward to anyone. A direct link is in a Peers audience when its peer is in the set.

A moq grant is a set of prefixes, each covering its whole subtree, so a visible publication with a hidden one beneath it is left out too: listing it would expose the hidden one. A path that is not a valid prefix is left out as well.

moq bounds the result: it refuses an AUTH_OK larger than 64 KiB. A link that may see publications whose paths add up to more bytes cannot be granted them one by one.