Skip to content

Commit c10d7c3

Browse files
committed
rename write_async to write
1 parent aba5d24 commit c10d7c3

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

lightning-persister/src/fs_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl KVStore for FilesystemStore {
208208
Ok(buf)
209209
}
210210

211-
fn write_async(
211+
fn write(
212212
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, buf: &[u8],
213213
) -> AsyncResultType<'static, (), lightning::io::Error> {
214214
let res = self.write(primary_namespace, secondary_namespace, key, buf);

lightning/src/util/persist.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub trait KVStore {
136136
///
137137
/// Will create the given `primary_namespace` and `secondary_namespace` if not already present
138138
/// in the store.
139-
fn write_async(
139+
fn write(
140140
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, buf: &[u8],
141141
) -> AsyncResultType<'static, (), io::Error>;
142142
/// Removes any data that had previously been persisted under the given `key`.
@@ -195,15 +195,14 @@ pub async fn migrate_kv_store_data<S: MigratableKVStore, T: MigratableKVStore>(
195195

196196
for (primary_namespace, secondary_namespace, key) in &keys_to_migrate {
197197
let data = source_store.read(primary_namespace, secondary_namespace, key)?;
198-
target_store
199-
.write_async(primary_namespace, secondary_namespace, key, &data)
200-
.await
201-
.map_err(|_| {
198+
target_store.write(primary_namespace, secondary_namespace, key, &data).await.map_err(
199+
|_| {
202200
io::Error::new(
203201
io::ErrorKind::Other,
204202
"Failed to write data to target store during migration",
205203
)
206-
})?;
204+
},
205+
)?;
207206
}
208207

209208
Ok(())
@@ -245,7 +244,7 @@ where
245244

246245
Box::pin(async move {
247246
kv_store
248-
.write_async(
247+
.write(
249248
CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE,
250249
CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE,
251250
CHANNEL_MANAGER_PERSISTENCE_KEY,
@@ -258,7 +257,7 @@ where
258257
fn persist_graph(
259258
&self, network_graph: &NetworkGraph<L>,
260259
) -> AsyncResultType<'static, (), io::Error> {
261-
self.write_async(
260+
self.write(
262261
NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE,
263262
NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE,
264263
NETWORK_GRAPH_PERSISTENCE_KEY,
@@ -267,7 +266,7 @@ where
267266
}
268267

269268
fn persist_scorer(&self, scorer: &S) -> AsyncResultType<'static, (), io::Error> {
270-
self.write_async(
269+
self.write(
271270
SCORER_PERSISTENCE_PRIMARY_NAMESPACE,
272271
SCORER_PERSISTENCE_SECONDARY_NAMESPACE,
273272
SCORER_PERSISTENCE_KEY,
@@ -292,7 +291,7 @@ impl<ChannelSigner: EcdsaChannelSigner, K: KVStore + ?Sized + Sync + Send + 'sta
292291

293292
Box::pin(async move {
294293
kv_store
295-
.write_async(
294+
.write(
296295
CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
297296
CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
298297
&monitor_name.to_string(),
@@ -312,7 +311,7 @@ impl<ChannelSigner: EcdsaChannelSigner, K: KVStore + ?Sized + Sync + Send + 'sta
312311

313312
Box::pin(async move {
314313
kv_store
315-
.write_async(
314+
.write(
316315
CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
317316
CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
318317
&monitor_name.to_string(),
@@ -337,7 +336,7 @@ impl<ChannelSigner: EcdsaChannelSigner, K: KVStore + ?Sized + Sync + Send + 'sta
337336
Err(_) => return,
338337
};
339338
match kv_store
340-
.write_async(
339+
.write(
341340
ARCHIVED_CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
342341
ARCHIVED_CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
343342
monitor_key.as_str(),
@@ -865,7 +864,7 @@ where
865864

866865
// Serialize and write the new monitor
867866
self.kv_store
868-
.write_async(
867+
.write(
869868
CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
870869
CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
871870
monitor_key.as_str(),
@@ -896,7 +895,7 @@ where
896895
let monitor_key = monitor_name.to_string();
897896
let update_name = UpdateName::from(update_id);
898897
self.kv_store
899-
.write_async(
898+
.write(
900899
CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE,
901900
monitor_key.as_str(),
902901
update_name.as_str(),
@@ -960,7 +959,7 @@ where
960959
};
961960
match self
962961
.kv_store
963-
.write_async(
962+
.write(
964963
ARCHIVED_CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
965964
ARCHIVED_CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
966965
monitor_key.as_str(),

lightning/src/util/sweep.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ where
592592

593593
async fn persist_state(&self, sweeper_state: &SweeperState) -> Result<(), io::Error> {
594594
self.kv_store
595-
.write_async(
595+
.write(
596596
OUTPUT_SWEEPER_PERSISTENCE_PRIMARY_NAMESPACE,
597597
OUTPUT_SWEEPER_PERSISTENCE_SECONDARY_NAMESPACE,
598598
OUTPUT_SWEEPER_PERSISTENCE_KEY,

0 commit comments

Comments
 (0)