pub struct ShardServer { /* private fields */ }Expand description
Server implementation for a shard.
ShardServer wraps a ShardedColony and implements the ShardService trait,
allowing remote clients to interact with the shard via tarpc RPC.
§Thread Safety
The server uses Arc<RwLock<ShardedColony>> to allow safe concurrent access
from multiple RPC handler tasks.
§Example
ⓘ
use phago_distributed::rpc::server::ShardServer;
use phago_distributed::shard::ShardedColony;
let shard = Arc::new(RwLock::new(ShardedColony::new(...)));
let server = ShardServer::new(shard);
server.serve("127.0.0.1:8080".parse().unwrap()).await?;Implementations§
Source§impl ShardServer
impl ShardServer
Trait Implementations§
Source§impl Clone for ShardServer
impl Clone for ShardServer
Source§fn clone(&self) -> ShardServer
fn clone(&self) -> ShardServer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ShardService for ShardServer
impl ShardService for ShardServer
Source§async fn ingest_document(
self,
_ctx: Context,
doc: Document,
) -> RpcResult<DocumentId>
async fn ingest_document( self, _ctx: Context, doc: Document, ) -> RpcResult<DocumentId>
Ingest a document into this shard. Read more
Source§async fn tick_phase(
self,
_ctx: Context,
phase: TickPhase,
tick: u64,
) -> RpcResult<PhaseResult>
async fn tick_phase( self, _ctx: Context, phase: TickPhase, tick: u64, ) -> RpcResult<PhaseResult>
Execute a tick phase on this shard. Read more
Source§async fn local_query(
self,
_ctx: Context,
req: LocalQueryRequest,
) -> RpcResult<LocalQueryResult>
async fn local_query( self, _ctx: Context, req: LocalQueryRequest, ) -> RpcResult<LocalQueryResult>
Execute a local query (part of distributed query). Read more
Source§async fn get_term_frequencies(
self,
_ctx: Context,
terms: Vec<String>,
) -> RpcResult<HashMap<String, u64>>
async fn get_term_frequencies( self, _ctx: Context, terms: Vec<String>, ) -> RpcResult<HashMap<String, u64>>
Get term frequencies for global DF computation. Read more
Source§async fn get_node(
self,
_ctx: Context,
id: NodeId,
) -> RpcResult<Option<NodeData>>
async fn get_node( self, _ctx: Context, id: NodeId, ) -> RpcResult<Option<NodeData>>
Fetch a node’s full data (for ghost node resolution). Read more
Source§async fn health_check(self, _ctx: Context) -> RpcResult<ShardHealth>
async fn health_check(self, _ctx: Context) -> RpcResult<ShardHealth>
Health check. Read more
Source§async fn resolve_ghost_nodes(
self,
_ctx: Context,
node_ids: Vec<NodeId>,
) -> RpcResult<Vec<GhostNode>>
async fn resolve_ghost_nodes( self, _ctx: Context, node_ids: Vec<NodeId>, ) -> RpcResult<Vec<GhostNode>>
Resolve cross-shard edges by fetching ghost node data. Read more
Source§async fn get_neighbors(
self,
_ctx: Context,
node_id: NodeId,
) -> RpcResult<Vec<NodeId>>
async fn get_neighbors( self, _ctx: Context, node_id: NodeId, ) -> RpcResult<Vec<NodeId>>
Get the list of nodes connected to a given node. Read more
Source§async fn receive_signals(
self,
_ctx: Context,
signals: Vec<CrossShardSignal>,
) -> RpcResult<()>
async fn receive_signals( self, _ctx: Context, signals: Vec<CrossShardSignal>, ) -> RpcResult<()>
Receive cross-shard signals during the Exchange phase. Read more
Source§fn serve(self) -> ServeShardService<Self>
fn serve(self) -> ServeShardService<Self>
Returns a serving function to use with
InFlightRequest::execute.
Auto Trait Implementations§
impl !RefUnwindSafe for ShardServer
impl !Send for ShardServer
impl !Sync for ShardServer
impl !UnwindSafe for ShardServer
impl Freeze for ShardServer
impl Unpin for ShardServer
impl UnsafeUnpin for ShardServer
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
Mutably borrows from an owned value. Read more