feat!: rm persist submodule

Remove `PersistBackend`, `PersistBackendAsync`, `StageExt` and
`StageExtAsync`. Remove `async` feature flag and dependency. Update
examples and wallet.
This commit is contained in:
志宇
2024-06-14 20:42:25 +08:00
parent 782eb56bd4
commit 1eca568be5
18 changed files with 239 additions and 469 deletions

View File

@@ -1,6 +1,6 @@
# BDK File Store
This is a simple append-only flat file implementation of [`PersistBackend`](bdk_chain::persist::PersistBackend).
This is a simple append-only flat file database for persisting [`bdk_chain`] changesets.
The main structure is [`Store`] which works with any [`bdk_chain`] based changesets to persist data into a flat file.

View File

@@ -1,5 +1,4 @@
use crate::{bincode_options, EntryIter, FileError, IterError};
use bdk_chain::persist::PersistBackend;
use bdk_chain::Append;
use bincode::Options;
use std::{
@@ -21,27 +20,6 @@ where
marker: PhantomData<C>,
}
impl<C> PersistBackend<C> for Store<C>
where
C: Append
+ Debug
+ serde::Serialize
+ serde::de::DeserializeOwned
+ core::marker::Send
+ core::marker::Sync,
{
type WriteError = io::Error;
type LoadError = AggregateChangesetsError<C>;
fn write_changes(&mut self, changeset: &C) -> Result<(), Self::WriteError> {
self.append_changeset(changeset)
}
fn load_changes(&mut self) -> Result<Option<C>, Self::LoadError> {
self.aggregate_changesets()
}
}
impl<C> Store<C>
where
C: Append
@@ -448,7 +426,7 @@ mod test {
acc
});
// We write after a short read.
db.write_changes(&last_changeset)
db.append_changeset(&last_changeset)
.expect("last write must succeed");
Append::append(&mut exp_aggregation, last_changeset.clone());
drop(db);