Skip to main content

PdsPublisher

Struct PdsPublisher 

Source
pub struct PdsPublisher { /* private fields */ }

Implementations§

Source§

impl PdsPublisher

Source

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.

Source

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.

Source

pub fn with_es256_store(self, store: Arc<Es256SigningKeyStore>) -> Self

Source

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.

Source

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.

Source

pub fn ingest_at9p_genesis( &self, did: &str, capsule_bytes: &[u8], ) -> AnyResult<AcceptedAt9pState>

Source

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).

Source

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).

Source

pub fn ingest_at9p_successor( &self, did: &str, update_bytes: &[u8], now: &str, ) -> AnyResult<AcceptedAt9pState>

Source

pub fn accepted_at9p_state( &self, did: &str, now: Option<&str>, ) -> AnyResult<AcceptedAt9pState>

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

impl<T> Identity for T
where T: ?Sized,

§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> JaggedSlice<T> for T

§

type Index = Index2

§

fn push_into(self, array: &mut Jagged<T>)

§

fn insert_into(self, index: <T as JaggedSlice<T>>::Index, array: &mut Jagged<T>)

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> MaybeSync for T
where T: Sync,