pub struct PdsPublisher { /* private fields */ }Implementations§
Source§impl PdsPublisher
impl PdsPublisher
Sourcepub fn new<S: IntoPdsGenerationSource>(
store: Arc<PdsRecordStore>,
did: String,
source: S,
) -> Self
pub fn new<S: IntoPdsGenerationSource>( store: Arc<PdsRecordStore>, did: String, source: S, ) -> Self
Construct with a fixed signing key. Preserved for tests and simple
embedders; production wiring uses Self::with_generation_source so
the publisher observes rotations.
Sourcepub fn with_generation_source(
store: Arc<PdsRecordStore>,
did: String,
source: Arc<dyn ActiveGenerationSource>,
) -> Self
pub fn with_generation_source( store: Arc<PdsRecordStore>, did: String, source: Arc<dyn ActiveGenerationSource>, ) -> Self
Construct with a live generation source — the production shape (#1123).
The publisher resolves the active #atproto key from source at every
sign, so it never freezes a retired key.
pub fn with_es256_store(self, store: Arc<Es256SigningKeyStore>) -> Self
Sourcepub fn with_at9p_state_ingest(self, ingest: At9pStateIngest) -> Self
pub fn with_at9p_state_ingest(self, ingest: At9pStateIngest) -> Self
Install the daemon-owned accepted-state ingest boundary. Production construction always calls this; the optional form keeps isolated PDS pointer-store tests free of unrelated audit-key setup.
Sourcepub fn install_es256_promotion_hook(self: &Arc<Self>) -> AnyResult<()>
pub fn install_es256_promotion_hook(self: &Arc<Self>) -> AnyResult<()>
Connect this publisher to the shared ES256 store’s in-process
lead→active transition. A weak reference avoids a publisher→store→
publisher reference cycle; if its target has been dropped, the hook
errors so rotation remains pending. Cross---ipc delivery is deferred
to #1123.
pub fn ingest_at9p_genesis( &self, did: &str, capsule_bytes: &[u8], ) -> AnyResult<AcceptedAt9pState>
Sourcepub fn at9p_record_store(&self) -> &Arc<PdsRecordStore> ⓘ
pub fn at9p_record_store(&self) -> &Arc<PdsRecordStore> ⓘ
The sole read-write record store this publisher owns. Exposed for the in-daemon at9p renewal timer, which must reuse the LIVE handles — never re-open the store (the RocksDB directory LOCK excludes the second read-write opener this process already is).
Sourcepub fn at9p_state_ingest(&self) -> Option<&At9pStateIngest>
pub fn at9p_state_ingest(&self) -> Option<&At9pStateIngest>
The daemon-owned accepted-state ingest boundary, when configured. Renewal admission goes through this exact boundary (same guard, audit WAL, and checkpoint CAS as the RPC path).
pub fn ingest_at9p_successor( &self, did: &str, update_bytes: &[u8], now: &str, ) -> AnyResult<AcceptedAt9pState>
pub fn accepted_at9p_state( &self, did: &str, now: Option<&str>, ) -> AnyResult<AcceptedAt9pState>
Sourcepub fn publish(&self, repo_id: &str, current_oid_hex: &str) -> AnyResult<()>
pub fn publish(&self, repo_id: &str, current_oid_hex: &str) -> AnyResult<()>
Publish (or advance) the ai.hyprstream.model record for repo_id,
pointing it at current_oid_hex (a git OID, hex-encoded).
Collection-parameterized publication lives in
Self::publish_record; this is the ai.hyprstream.model wrapper the
registry service calls — behavior unchanged from #910a.
Best-effort by design: the caller (registry service) should log and
continue on error rather than fail the git operation that triggered
this — the local git commit is the durable source of truth; a missed
PDS publish is caught up by the next successful one (same
eventual-consistency contract git::promote documents).
Sourcepub fn publish_record(
&self,
collection: &str,
record_id: &str,
current_oid_hex: &str,
) -> AnyResult<()>
pub fn publish_record( &self, collection: &str, record_id: &str, current_oid_hex: &str, ) -> AnyResult<()>
Publish (or advance) a record in collection for record_id, pointing
it at current_oid_hex (a git OID, hex-encoded). This is the
collection-parameterized publication path (#910b): the repo’s ONE MST
spans every collection, and the ONE commit signed here covers them all.
The record’s rkey is derived deterministically from record_id
(PdsRecordStore::tid_for_repo) and reused on every call, so this
always replaces the existing record’s value rather than creating a
new one. (rkeys are scoped per collection in atproto, so the same
record_id in two collections is two distinct records at
<collection-a>/<rkey> and <collection-b>/<rkey>.) The repo’s MST is
rebuilt over its full multi-collection record set, a new commit is
signed once here (rev strictly advances; prev points at the
previous commit’s CID — the atproto pointer advance), and the record
and signed commit are persisted together.
Sourcepub fn publish_ledger_allocation(&self, rec: &AllocationRecord) -> AnyResult<()>
pub fn publish_ledger_allocation(&self, rec: &AllocationRecord) -> AnyResult<()>
Publish (or advance) a holder-controlled ai.hyprstream.ledger.allocation
record — the held entitlement (#924).
The allocation’s canonical DAG-CBOR bytes are content-addressed and the
resulting CID becomes the pointer this repo’s MST carries under the
ai.hyprstream.ledger.allocation collection; the holder’s signed PDS
commit is the only signature the record needs (it lives in the holder’s
own repo). The rkey is derived deterministically from the record’s grant
CID, so re-publishing the same grant advances the same record.
Sourcepub fn publish_ledger_receipt(&self, rec: &ReceiptRecord) -> AnyResult<()>
pub fn publish_ledger_receipt(&self, rec: &ReceiptRecord) -> AnyResult<()>
Publish (or advance) a holder-controlled ai.hyprstream.ledger.receipt
record — a dual-signed usage record (#924).
The rkey is derived from the receipt’s transferId, giving at-least-once
(idempotent) receipt delivery: re-publishing the same transfer advances
the same record rather than creating a duplicate.
Sourcepub fn publish_ledger_checkpoint(
&self,
ledger_id: &str,
rec: &CheckpointRecord,
) -> AnyResult<()>
pub fn publish_ledger_checkpoint( &self, ledger_id: &str, rec: &CheckpointRecord, ) -> AnyResult<()>
Publish (or advance) a holder-controlled ai.hyprstream.ledger.checkpoint
record — a signed ledger head (#924).
ledger_id is the stable key of the ledger whose head this checkpoint
commits, so successive checkpoints advance the one head pointer.
Sourcepub fn resign_head(&self) -> AnyResult<bool>
pub fn resign_head(&self) -> AnyResult<bool>
#918 re-sign-on-rotation: re-sign the EXISTING persisted repo head with
the authenticated active #atproto generation, leaving the MST root,
rev, and prev unchanged. Cross-process maintenance uses the same
sealed generation source as ordinary publication, never the optional
process-local key cache. The guarded in-process promotion hook uses
resign_head_with_key with its not-yet-published candidate instead.
Holds the publish_lock to serialize with concurrent publishes. Returns
Ok(true) if the head was re-signed; no repo or an already-current
signature is an exact no-op. Missing/unverifiable authority fails closed
when a repo exists. The writer’s maintenance tick attempts reconciliation;
downtime or failed ticks can outlast overlap, so recovery does not imply
uninterrupted public-read availability during that interval.
Auto Trait Implementations§
impl !Freeze for PdsPublisher
impl !RefUnwindSafe for PdsPublisher
impl Send for PdsPublisher
impl Sync for PdsPublisher
impl Unpin for PdsPublisher
impl UnsafeUnpin for PdsPublisher
impl !UnwindSafe for PdsPublisher
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request