pub struct PlacementIndex { /* private fields */ }Expand description
In-process placement directory index. Rebuilt by polling
RecordResolver::resolve_repo for a bootstrap set of node DIDs (day-1
ingestion — see the module docs). Read from the queryCandidates request
path; written by the poller. parking_lot::RwLock mirrors the precedent
already used for DiscoveryService’s other in-memory maps.
Implementations§
Source§impl PlacementIndex
impl PlacementIndex
pub fn new() -> Self
Sourcepub async fn ingest_did(
&self,
resolver: &dyn RecordResolver,
did: &str,
) -> Result<()>
pub async fn ingest_did( &self, resolver: &dyn RecordResolver, did: &str, ) -> Result<()>
Poll did’s repo via resolver and (re-)ingest its placement records,
replacing whatever this DID contributed on a previous poll.
Ok(()) with no visible effect when the DID has no stored repo (nothing
to ingest) or its repo carries no placement records — this is not an
error, just an empty directory entry.
Verified by construction (#932, #918): the resolver MUST supply a
verification slots for did (RecordResolver::resolve_verifying_keys); if it
cannot, the repo is rejected (fail closed) — its records never reach
the derived indices. Every CAR block is always content-bound to its
declared CID. A repo that fails signature verification — or whose
commit.did is not did — is refused, and this returns Err (the
caller — handle_report_node_liveness — logs and continues; liveness is
still recorded).
The production resolver currently returns None for both the local
node’s mismatched did:key authority (#1124) and foreign DIDs (no DID-
document fetch is wired yet). Those repos are rejected rather than
silently ingested unverified. Foreign resolution is tracked with #1123.
Sourcepub fn known_node_dids(&self) -> Vec<String>
pub fn known_node_dids(&self) -> Vec<String>
All node DIDs currently known to the index (have an ingested
NodeRecord).
Sourcepub fn record_uri(&self, did: &str) -> Option<String>
pub fn record_uri(&self, did: &str) -> Option<String>
The at-uri of did’s NodeRecord, if known.
Sourcepub fn is_member(&self, node_did: &str, group_uri: &str) -> bool
pub fn is_member(&self, node_did: &str, group_uri: &str) -> bool
Whether node_did is an effective (bidirectional-consent) member of
group_uri: the group owner must have published a GroupItemRecord
naming this node, and the node’s own NodeRecord.groups must list
this group. Either claim alone is not membership.
Trust statement (#932): membership facts returned here are always
content-bound and signature-verified. A GroupItemRecord / NodeRecord
whose repo CAR commit failed
signature verification against the resolver-provided #atproto key,
whose commit.did is not the
requested DID, or whose any block’s recomputed CID ≠ its declared CID
never entered the index, so it cannot back a true result. The per-block
CID binding is what stops a replayed genuine signed commit carrying
substituted blocks from forging membership. See the module trust-posture
docs for the verified-by-construction, fail-closed ingest gate.
Sourcepub fn effective_labels(&self, node_did: &str) -> Vec<(String, String)>
pub fn effective_labels(&self, node_did: &str) -> Vec<(String, String)>
A node’s effective label set for selector matching: its declared
NodeRecord.labels plus one synthetic ("group/<uri>", "true") label
per group it is an effective (bidirectional-consent) member of. See
the module docs for why group membership uses a per-group label key.
Trait Implementations§
Source§impl Default for PlacementIndex
impl Default for PlacementIndex
Source§fn default() -> PlacementIndex
fn default() -> PlacementIndex
Auto Trait Implementations§
impl !Freeze for PlacementIndex
impl !RefUnwindSafe for PlacementIndex
impl Send for PlacementIndex
impl Sync for PlacementIndex
impl Unpin for PlacementIndex
impl UnsafeUnpin for PlacementIndex
impl UnwindSafe for PlacementIndex
Blanket Implementations§
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more