mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 05:11:02 +00:00
core/network: Remove self mutability on put and get value (#3118)
Make `NetworkService.{get,put}_value` only take a self reference instead
of a mutable self reference. When retrieving `NetworkService` via
`NetworkWorker`, one only gets an immutable reference.
This commit is contained in:
@@ -442,7 +442,7 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> NetworkServic
|
|||||||
///
|
///
|
||||||
/// This will generate either a `ValueFound` or a `ValueNotFound` event and pass it to
|
/// This will generate either a `ValueFound` or a `ValueNotFound` event and pass it to
|
||||||
/// `on_event` on the network specialization.
|
/// `on_event` on the network specialization.
|
||||||
pub fn get_value(&mut self, key: &Multihash) {
|
pub fn get_value(&self, key: &Multihash) {
|
||||||
let _ = self
|
let _ = self
|
||||||
.to_worker
|
.to_worker
|
||||||
.unbounded_send(ServerToWorkerMsg::GetValue(key.clone()));
|
.unbounded_send(ServerToWorkerMsg::GetValue(key.clone()));
|
||||||
@@ -452,7 +452,7 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> NetworkServic
|
|||||||
///
|
///
|
||||||
/// This will generate either a `ValuePut` or a `ValuePutFailed` event and pass it to
|
/// This will generate either a `ValuePut` or a `ValuePutFailed` event and pass it to
|
||||||
/// `on_event` on the network specialization.
|
/// `on_event` on the network specialization.
|
||||||
pub fn put_value(&mut self, key: Multihash, value: Vec<u8>) {
|
pub fn put_value(&self, key: Multihash, value: Vec<u8>) {
|
||||||
let _ = self
|
let _ = self
|
||||||
.to_worker
|
.to_worker
|
||||||
.unbounded_send(ServerToWorkerMsg::PutValue(key, value));
|
.unbounded_send(ServerToWorkerMsg::PutValue(key, value));
|
||||||
|
|||||||
Reference in New Issue
Block a user