Skip to main content

Crate rostra_client

Crate rostra_client 

Source
Expand description

A runtime client for one Rostra identity.

Client is the supported entry point. Construct it with Client::builder: omitting Database creates a temporary in-memory, light client. Supplying a durable database creates a full client and enables replication and projection tasks. Clients start read-only unless the builder receives a RostraIdSecretKey or Client::unlock_active is called later.

Client-created transports default to relay-only mode so that creating a client does not expose its host’s IP address. Call the builder’s public_mode(true) only when direct IP connectivity is an intentional privacy tradeoff. A caller that supplies iroh_endpoint owns that endpoint’s transport and privacy policy. The request handler is enabled by default in both storage modes; durable clients also start background synchronization by default.

A client owns its background tasks. Clone the returned std::sync::Arc to keep the runtime alive; dropping the final strong reference aborts those tasks. ClientHandle is weak and does not extend the runtime’s lifetime. There is no separate shutdown protocol.

Initialization, activation, peer connection, publication, and explicit synchronization return typed errors from error or DbError. A database failure in background ingestion is logged and stops the affected worker; the client does not globally restart failed workers. Database access remains available through Client::db for integrations that need Rostra’s materialized views.

Re-exports§

pub use crate::id::CompactTicket;
pub use crate::id::IdPublishedData;
pub use crate::id::IdResolvedData;
pub use crate::multiclient::MultiClient;
pub use crate::multiclient::MultiClientError;
pub use crate::multiclient::MultiClientResult;

Modules§

error
id
multiclient

Structs§

Client
The networked runtime for one Rostra identity.
ClientHandle
Weak handle to Client
ClientRef
A strong reference to Client
ClientRefError
Database
The authoritative event store and projection boundary for one local identity.
ExternalEventId
Full, external event id
IdP2PState
Per-identity P2P connection state for debugging.
NodeP2PState
Per-node (Iroh endpoint) connection state for debugging.
P2PState
In-memory P2P state for all known identities.
RostraId
RostraIdSecretKey
SelfFollowee
One active direct follow in a coherent current self-follow snapshot.
ShortEventId
ShortEventId is short (16B) because it is always used in a context of an existing id::RostraId so even though client might potentially grind collisions (64-bits of resistance) it really gains them nothing.
SocialPostMaterializationCursor
Opaque durable position in one database lineage’s SocialPost materialization feed.
SocialPostMaterializationPage
One bounded snapshot page from the ordinary SocialPost materialization feed.

Enums§

DbError
NodeSource
How we learned about a node.
SocialPostMaterialization
Current high-level state of one logged ordinary SocialPost materialization.

Constants§

SOCIAL_POST_MATERIALIZATION_SCAN_MAX
Maximum number of materialization rows resolved by one scan.

Type Aliases§

ClientRefResult