Skip to content

Commit 9c561f4

Browse files
committed
f Drop all flags
1 parent 8a47ac7 commit 9c561f4

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

lightning/src/util/persist.rs

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -182,46 +182,16 @@ pub trait MigratableKVStore: KVStore {
182182
/// might get overriden. User must ensure `source_store` is not modified during operation,
183183
/// otherwise no consistency guarantees can be given.
184184
///
185-
/// Will re-read and validate the written data if `validate_data` is set.
186-
///
187185
/// Will abort and return an error if any IO operation fails. Note that in this case the
188186
/// `target_store` might get left in an intermediate state.
189-
///
190-
/// **Caution**: Will delete all data from `source_store` if `move_data` is set.
191187
pub fn migrate_kv_store_data<S: MigratableKVStore, T: MigratableKVStore>(
192-
source_store: &mut S, target_store: &mut T, validate_data: bool, move_data: bool,
188+
source_store: &mut S, target_store: &mut T,
193189
) -> Result<(), io::Error> {
194190
let keys_to_migrate = source_store.list_all_keys()?;
195191

196-
// First copy over all data.
197192
for (primary_namespace, secondary_namespace, key) in &keys_to_migrate {
198193
let data = source_store.read(primary_namespace, secondary_namespace, key)?;
199194
target_store.write(primary_namespace, secondary_namespace, key, &data)?;
200-
201-
// Now validate what we've written.
202-
if validate_data {
203-
let read_data = target_store.read(primary_namespace, secondary_namespace, &key)?;
204-
if data != read_data {
205-
let err =
206-
io::Error::new(io::ErrorKind::InvalidData, "Failed to validate migrated data");
207-
return Err(err);
208-
}
209-
}
210-
}
211-
212-
// If we succeeded and `move_data` is set, remove all migrated keys.
213-
if move_data {
214-
for (primary_namespace, secondary_namespace, key) in &keys_to_migrate {
215-
source_store.remove(primary_namespace, secondary_namespace, &key, false)?;
216-
}
217-
218-
if !source_store.list_all_keys()?.is_empty() {
219-
let err = io::Error::new(
220-
io::ErrorKind::InvalidData,
221-
"Source store is not empty. Was it modified during migration? This should never happen!"
222-
);
223-
return Err(err);
224-
}
225195
}
226196

227197
Ok(())

0 commit comments

Comments
 (0)