pub struct HashiverseClient { /* private fields */ }Expand description
The top-level client API for participating in a hashiverse network.
HashiverseClient is what every external consumer — the server binary’s cache role, the
WASM browser client, the Python wrapper, integration tests — builds on top of. It
orchestrates all the subsystems the client side needs:
- a
PeerTrackerfor Kademlia-style peer discovery and gossip, - a
LivePostBundleManager/LivePostBundleFeedbackManagerpair for fetching post bundles and their feedback from the network (with on-disk caching), - a
SingleTimeline/MultipleTimelinepair for recursive bucket traversal when reading a feed, - a
MetaPostManagerfor the user’s profile / follow list / settings, - a
RecentPostsPenso freshly-authored posts appear in the user’s own timelines immediately, - a
ClientId/KeyLockerpair for the signed identity used on every outbound action.
All external dependencies — clock, network, PoW — are carried through a single
RuntimeServices, which is what makes the same code run inside the in-memory integration
test harness, on a native server, and in a browser Web Worker without touching any of the
high-level logic above.
Construct one via HashiverseClient::new and keep a single instance per logged-in
account; the struct is cheap to share (Arc<Self>) and its internal state uses RwLocks
for concurrent access.
Implementations§
Source§impl HashiverseClient
impl HashiverseClient
pub async fn new( runtime_services: Arc<RuntimeServices>, client_storage: Arc<dyn ClientStorage>, key_locker: Arc<dyn KeyLocker>, _args: Args, ) -> Result<Self>
pub fn client_id(&self) -> &ClientId
pub async fn client_storage_reset(&self) -> Result<()>
pub async fn submit_post( &self, post: &str, ) -> Result<(Vec<SubmitPostCommitTokenV1>, (EncodedPostV1, Bytes)), Error>
pub fn meta_post_manager(&self) -> &MetaPostManager
pub async fn submit_meta_post(&self) -> Result<()>
pub async fn ensure_meta_post_in_current_bucket(&self) -> Result<()>
pub async fn submit_feedback( &self, bucket_location: BucketLocation, post_id: Id, feedback_type: u8, ) -> Result<()>
pub async fn get_post( &self, bucket_location: BucketLocation, post_id: &Id, ) -> Result<(BucketLocation, EncodedPostV1, Bytes)>
pub async fn get_post_feedbacks( &self, bucket_location: BucketLocation, post_id: Id, ) -> Result<[u64; 256]>
pub async fn single_timeline_reset(&self) -> Result<()>
pub async fn single_timeline_lock( &self, bucket_type: BucketType, base_id: &Id, ) -> Result<RwLockWriteGuard<'_, Option<SingleTimeline>>>
pub async fn single_timeline_get_more( &self, bucket_type: BucketType, base_id: &Id, ) -> Result<(Vec<(BucketLocation, EncodedPostV1, Bytes)>, TimeMillis)>
pub async fn multiple_timeline_reset(&self) -> Result<()>
pub async fn multiple_timeline_lock( &self, bucket_type: BucketType, base_ids: &Vec<Id>, ) -> Result<RwLockWriteGuard<'_, Option<MultipleTimeline>>>
pub async fn multiple_timeline_get_more( &self, bucket_type: BucketType, base_ids: &Vec<Id>, ) -> Result<(Vec<(BucketLocation, EncodedPostV1, Bytes)>, TimeMillis)>
pub async fn fetch_url_preview( &self, url: &str, ) -> Result<FetchUrlPreviewResponseV1>
pub async fn dispatch_command(&self, command: &String) -> Result<(), Error>
Auto Trait Implementations§
impl Freeze for HashiverseClient
impl !RefUnwindSafe for HashiverseClient
impl Send for HashiverseClient
impl Sync for HashiverseClient
impl Unpin for HashiverseClient
impl UnsafeUnpin for HashiverseClient
impl !UnwindSafe for HashiverseClient
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