mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Move import lock onto backend (#2797)
* Drop import_lock from client, move it into backend, impl default version via static mutex * still need to allow depcretion because of client.backend * additional docs * Remove default impl of get_import_lock, impl on instances * Bump parking_lot to 0.8.0 accross the board
This commit is contained in:
committed by
Bastian Köcher
parent
4f888f34d3
commit
eaa0ab014a
@@ -20,7 +20,7 @@
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Weak};
|
||||
use futures::{Future, IntoFuture};
|
||||
use parking_lot::RwLock;
|
||||
use parking_lot::{RwLock, Mutex};
|
||||
|
||||
use runtime_primitives::{generic::BlockId, Justification, StorageOverlay, ChildrenStorageOverlay};
|
||||
use state_machine::{Backend as StateBackend, TrieBackend, backend::InMemory as InMemoryState};
|
||||
@@ -41,6 +41,7 @@ const IN_MEMORY_EXPECT_PROOF: &str = "InMemory state backend has Void error type
|
||||
pub struct Backend<S, F, H: Hasher> {
|
||||
blockchain: Arc<Blockchain<S, F>>,
|
||||
genesis_state: RwLock<Option<InMemoryState<H>>>,
|
||||
import_lock: Mutex<()>,
|
||||
}
|
||||
|
||||
/// Light block (header and justification) import operation.
|
||||
@@ -77,6 +78,7 @@ impl<S, F, H: Hasher> Backend<S, F, H> {
|
||||
Self {
|
||||
blockchain,
|
||||
genesis_state: RwLock::new(None),
|
||||
import_lock: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,6 +215,10 @@ impl<S, F, Block, H> ClientBackend<Block, H> for Backend<S, F, H> where
|
||||
fn revert(&self, _n: NumberFor<Block>) -> ClientResult<NumberFor<Block>> {
|
||||
Err(ClientError::NotAvailableOnLightClient.into())
|
||||
}
|
||||
|
||||
fn get_import_lock(&self) -> &Mutex<()> {
|
||||
&self.import_lock
|
||||
}
|
||||
}
|
||||
|
||||
impl<S, F, Block, H> RemoteBackend<Block, H> for Backend<S, F, H>
|
||||
|
||||
Reference in New Issue
Block a user