Handle an internal request coming from a [`Client`].
(&mut self, request: Request<V>)
| 424 | |
| 425 | /// Handle an internal request coming from a [`Client`]. |
| 426 | fn handle_request(&mut self, request: Request<V>) { |
| 427 | match request { |
| 428 | Request::SetProvidedSubnets(ids) => { |
| 429 | if let Err(e) = self.membership_mut().set_provided_subnets(ids) { |
| 430 | warn!("failed to publish set provided subnets: {e}") |
| 431 | } |
| 432 | } |
| 433 | Request::AddProvidedSubnet(id) => { |
| 434 | if let Err(e) = self.membership_mut().add_provided_subnet(id) { |
| 435 | warn!("failed to publish added provided subnet: {e}") |
| 436 | } |
| 437 | } |
| 438 | Request::RemoveProvidedSubnet(id) => { |
| 439 | if let Err(e) = self.membership_mut().remove_provided_subnet(id) { |
| 440 | warn!("failed to publish removed provided subnet: {e}") |
| 441 | } |
| 442 | } |
| 443 | Request::PublishVote(vote) => { |
| 444 | if let Err(e) = self.membership_mut().publish_vote(*vote) { |
| 445 | warn!("failed to publish vote: {e}") |
| 446 | } |
| 447 | } |
| 448 | Request::PublishPreemptive(subnet_id, data) => { |
| 449 | if let Err(e) = self.membership_mut().publish_preemptive(subnet_id, data) { |
| 450 | warn!("failed to publish pre-emptive data: {e}") |
| 451 | } |
| 452 | } |
| 453 | Request::PinSubnet(id) => { |
| 454 | if let Err(e) = self.membership_mut().pin_subnet(id) { |
| 455 | warn!("error pinning subnet: {e}") |
| 456 | } |
| 457 | } |
| 458 | Request::UnpinSubnet(id) => { |
| 459 | if let Err(e) = self.membership_mut().unpin_subnet(&id) { |
| 460 | warn!("error unpinning subnet: {e}") |
| 461 | } |
| 462 | } |
| 463 | Request::Resolve(cid, subnet_id, response_channel) => { |
| 464 | self.start_query(cid, subnet_id, response_channel) |
| 465 | } |
| 466 | Request::RateLimitUsed(peer_id, bytes) => { |
| 467 | self.content_mut().rate_limit_used(peer_id, bytes) |
| 468 | } |
| 469 | Request::UpdateRateLimit(bytes) => self.content_mut().update_rate_limit(bytes), |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | /// Start a CID resolution. |
| 474 | fn start_query(&mut self, cid: Cid, subnet_id: SubnetID, response_channel: ResponseChannel) { |
nothing calls this directly
no test coverage detected