Trait ng_net::server_broker::IServerBroker

source ·
pub trait IServerBroker: Send + Sync {
Show 28 methods // Required methods fn get_path_users(&self) -> PathBuf; fn get_block_storage(&self) -> Arc<RwLock<dyn BlockStorage + Send + Sync>>; fn put_block( &self, overlay_id: &OverlayId, block: Block ) -> Result<(), ServerError>; fn has_block( &self, overlay_id: &OverlayId, block_id: &BlockId ) -> Result<(), ServerError>; fn get_block( &self, overlay_id: &OverlayId, block_id: &BlockId ) -> Result<Block, ServerError>; fn create_user<'life0, 'life1, 'async_trait>( &'life0 self, broker_id: &'life1 DirectPeerId ) -> Pin<Box<dyn Future<Output = Result<UserId, ProtocolError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_user(&self, user_id: PubKey) -> Result<bool, ProtocolError>; fn get_user_credentials( &self, user_id: &PubKey ) -> Result<Credentials, ProtocolError>; fn add_user_credentials( &self, user_id: &PubKey, credentials: &Credentials ) -> Result<(), ProtocolError>; fn add_user( &self, user_id: PubKey, is_admin: bool ) -> Result<(), ProtocolError>; fn del_user(&self, user_id: PubKey) -> Result<(), ProtocolError>; fn list_users(&self, admins: bool) -> Result<Vec<PubKey>, ProtocolError>; fn list_invitations( &self, admin: bool, unique: bool, multi: bool ) -> Result<Vec<(InvitationCode, u32, Option<String>)>, ProtocolError>; fn add_invitation( &self, invite_code: &InvitationCode, expiry: u32, memo: &Option<String> ) -> Result<(), ProtocolError>; fn get_invitation_type(&self, invite: [u8; 32]) -> Result<u8, ProtocolError>; fn remove_invitation(&self, invite: [u8; 32]) -> Result<(), ProtocolError>; fn app_process_request<'life0, 'life1, 'async_trait>( &'life0 self, req: AppRequest, request_id: i64, fsm: &'life1 Mutex<NoiseFSM> ) -> Pin<Box<dyn Future<Output = Result<(), ServerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn app_session_start<'life0, 'async_trait>( &'life0 self, req: AppSessionStart, remote_peer_id: DirectPeerId, local_peer_id: DirectPeerId ) -> Pin<Box<dyn Future<Output = Result<AppSessionStartResponse, ServerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn app_session_stop<'life0, 'life1, 'async_trait>( &'life0 self, req: AppSessionStop, remote_peer_id: &'life1 DirectPeerId ) -> Pin<Box<dyn Future<Output = Result<EmptyAppResponse, ServerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn next_seq_for_peer( &self, peer: &PeerId, seq: u64 ) -> Result<(), ServerError>; fn get_repo_pin_status( &self, overlay: &OverlayId, repo: &RepoHash, user_id: &UserId ) -> Result<RepoPinStatus, ServerError>; fn pin_repo_write<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'async_trait>( &'life0 self, overlay: &'life1 OverlayAccess, repo: &'life2 RepoHash, user_id: &'life3 UserId, ro_topics: &'life4 Vec<TopicId>, rw_topics: &'life5 Vec<PublisherAdvert>, overlay_root_topic: &'life6 Option<TopicId>, expose_outer: bool, peer: &'life7 ClientPeerId ) -> Pin<Box<dyn Future<Output = Result<RepoOpened, ServerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait, 'life7: 'async_trait; fn pin_repo_read<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, overlay: &'life1 OverlayId, repo: &'life2 RepoHash, user_id: &'life3 UserId, ro_topics: &'life4 Vec<TopicId>, peer: &'life5 ClientPeerId ) -> Pin<Box<dyn Future<Output = Result<RepoOpened, ServerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait; fn topic_sub<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 self, overlay: &'life1 OverlayId, repo: &'life2 RepoHash, topic: &'life3 TopicId, user_id: &'life4 UserId, publisher: Option<&'life5 PublisherAdvert>, peer: &'life6 ClientPeerId ) -> Pin<Box<dyn Future<Output = Result<TopicSubRes, ServerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait; fn get_commit( &self, overlay: &OverlayId, id: &ObjectId ) -> Result<Vec<Block>, ServerError>; fn dispatch_event<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, overlay: &'life1 OverlayId, event: Event, user_id: &'life2 UserId, remote_peer: &'life3 PubKey ) -> Pin<Box<dyn Future<Output = Result<Vec<ClientPeerId>, ServerError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn remove_all_subscriptions_of_client<'life0, 'life1, 'async_trait>( &'life0 self, client: &'life1 ClientPeerId ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn topic_sync_req( &self, overlay: &OverlayId, topic: &TopicId, known_heads: &Vec<ObjectId>, target_heads: &Vec<ObjectId>, known_commits: &Option<BloomFilter> ) -> Result<Vec<TopicSyncRes>, ServerError>;
}

Required Methods§

source

fn get_path_users(&self) -> PathBuf

source

fn get_block_storage(&self) -> Arc<RwLock<dyn BlockStorage + Send + Sync>>

source

fn put_block( &self, overlay_id: &OverlayId, block: Block ) -> Result<(), ServerError>

source

fn has_block( &self, overlay_id: &OverlayId, block_id: &BlockId ) -> Result<(), ServerError>

source

fn get_block( &self, overlay_id: &OverlayId, block_id: &BlockId ) -> Result<Block, ServerError>

source

fn create_user<'life0, 'life1, 'async_trait>( &'life0 self, broker_id: &'life1 DirectPeerId ) -> Pin<Box<dyn Future<Output = Result<UserId, ProtocolError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn get_user(&self, user_id: PubKey) -> Result<bool, ProtocolError>

source

fn get_user_credentials( &self, user_id: &PubKey ) -> Result<Credentials, ProtocolError>

source

fn add_user_credentials( &self, user_id: &PubKey, credentials: &Credentials ) -> Result<(), ProtocolError>

source

fn add_user(&self, user_id: PubKey, is_admin: bool) -> Result<(), ProtocolError>

source

fn del_user(&self, user_id: PubKey) -> Result<(), ProtocolError>

source

fn list_users(&self, admins: bool) -> Result<Vec<PubKey>, ProtocolError>

source

fn list_invitations( &self, admin: bool, unique: bool, multi: bool ) -> Result<Vec<(InvitationCode, u32, Option<String>)>, ProtocolError>

source

fn add_invitation( &self, invite_code: &InvitationCode, expiry: u32, memo: &Option<String> ) -> Result<(), ProtocolError>

source

fn get_invitation_type(&self, invite: [u8; 32]) -> Result<u8, ProtocolError>

source

fn remove_invitation(&self, invite: [u8; 32]) -> Result<(), ProtocolError>

source

fn app_process_request<'life0, 'life1, 'async_trait>( &'life0 self, req: AppRequest, request_id: i64, fsm: &'life1 Mutex<NoiseFSM> ) -> Pin<Box<dyn Future<Output = Result<(), ServerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn app_session_start<'life0, 'async_trait>( &'life0 self, req: AppSessionStart, remote_peer_id: DirectPeerId, local_peer_id: DirectPeerId ) -> Pin<Box<dyn Future<Output = Result<AppSessionStartResponse, ServerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn app_session_stop<'life0, 'life1, 'async_trait>( &'life0 self, req: AppSessionStop, remote_peer_id: &'life1 DirectPeerId ) -> Pin<Box<dyn Future<Output = Result<EmptyAppResponse, ServerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn next_seq_for_peer(&self, peer: &PeerId, seq: u64) -> Result<(), ServerError>

source

fn get_repo_pin_status( &self, overlay: &OverlayId, repo: &RepoHash, user_id: &UserId ) -> Result<RepoPinStatus, ServerError>

source

fn pin_repo_write<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'async_trait>( &'life0 self, overlay: &'life1 OverlayAccess, repo: &'life2 RepoHash, user_id: &'life3 UserId, ro_topics: &'life4 Vec<TopicId>, rw_topics: &'life5 Vec<PublisherAdvert>, overlay_root_topic: &'life6 Option<TopicId>, expose_outer: bool, peer: &'life7 ClientPeerId ) -> Pin<Box<dyn Future<Output = Result<RepoOpened, ServerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait, 'life7: 'async_trait,

source

fn pin_repo_read<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, overlay: &'life1 OverlayId, repo: &'life2 RepoHash, user_id: &'life3 UserId, ro_topics: &'life4 Vec<TopicId>, peer: &'life5 ClientPeerId ) -> Pin<Box<dyn Future<Output = Result<RepoOpened, ServerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

source

fn topic_sub<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 self, overlay: &'life1 OverlayId, repo: &'life2 RepoHash, topic: &'life3 TopicId, user_id: &'life4 UserId, publisher: Option<&'life5 PublisherAdvert>, peer: &'life6 ClientPeerId ) -> Pin<Box<dyn Future<Output = Result<TopicSubRes, ServerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait,

source

fn get_commit( &self, overlay: &OverlayId, id: &ObjectId ) -> Result<Vec<Block>, ServerError>

source

fn dispatch_event<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, overlay: &'life1 OverlayId, event: Event, user_id: &'life2 UserId, remote_peer: &'life3 PubKey ) -> Pin<Box<dyn Future<Output = Result<Vec<ClientPeerId>, ServerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

source

fn remove_all_subscriptions_of_client<'life0, 'life1, 'async_trait>( &'life0 self, client: &'life1 ClientPeerId ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn topic_sync_req( &self, overlay: &OverlayId, topic: &TopicId, known_heads: &Vec<ObjectId>, target_heads: &Vec<ObjectId>, known_commits: &Option<BloomFilter> ) -> Result<Vec<TopicSyncRes>, ServerError>

Implementors§