mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 18:35:41 +00:00
Fix state-db pinning (#12927)
* Pin all canonicalized blocks * Added a test * Docs
This commit is contained in:
@@ -470,6 +470,10 @@ impl<BlockHash: Hash, Key: Hash, D: MetaDb> StateDbSync<BlockHash, Key, D> {
|
||||
}
|
||||
}
|
||||
|
||||
fn sync(&mut self) {
|
||||
self.non_canonical.sync();
|
||||
}
|
||||
|
||||
pub fn get<DB: NodeDb, Q: ?Sized>(
|
||||
&self,
|
||||
key: &Q,
|
||||
@@ -573,6 +577,12 @@ impl<BlockHash: Hash, Key: Hash, D: MetaDb> StateDb<BlockHash, Key, D> {
|
||||
self.db.write().unpin(hash)
|
||||
}
|
||||
|
||||
/// Confirm that all changes made to commit sets are on disk. Allows for temporarily pinned
|
||||
/// blocks to be released.
|
||||
pub fn sync(&self) {
|
||||
self.db.write().sync()
|
||||
}
|
||||
|
||||
/// Get a value from non-canonical/pruning overlay or the backing DB.
|
||||
pub fn get<DB: NodeDb, Q: ?Sized>(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user