blockchain/backend/
mod.rs1mod memory;
4mod route;
5mod traits;
6mod operation;
7mod state;
8
9pub use self::memory::{MemoryBackend, MemoryDatabase, SharedMemoryBackend, Error as MemoryError};
10pub use self::route::{tree_route, TreeRoute};
11pub use self::operation::{BlockData, ImportOperation, Operation};
12pub use self::traits::{Store, ChainQuery, ChainSettlement, OperationError, Committable, SharedCommittable};
13pub use self::state::KeyValueMemoryState;
14
15use std::sync::{Arc, Mutex, MutexGuard};
16
17pub struct ImportLock(Arc<Mutex<()>>);
19
20impl Clone for ImportLock {
21 fn clone(&self) -> Self {
22 Self(self.0.clone())
23 }
24}
25
26impl ImportLock {
27 pub fn new() -> Self {
29 Self(Arc::new(Mutex::new(())))
30 }
31
32 pub fn lock(&self) -> MutexGuard<()> {
34 self.0.lock().expect("Lock is poisoned")
35 }
36}