@@ -415,10 +415,10 @@ macro_rules! define_run_body {
415415 if $channel_manager. get_cm( ) . get_and_clear_needs_persistence( ) {
416416 log_trace!( $logger, "Persisting ChannelManager..." ) ;
417417 maybe_await!( $async_persist, $kv_store. write(
418- CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE ,
419- CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE ,
420- CHANNEL_MANAGER_PERSISTENCE_KEY ,
421- & $channel_manager. get_cm( ) . encode( ) ,
418+ CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE . to_string ( ) ,
419+ CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE . to_string ( ) ,
420+ CHANNEL_MANAGER_PERSISTENCE_KEY . to_string ( ) ,
421+ $channel_manager. get_cm( ) . encode( ) ,
422422 ) ) ?;
423423 log_trace!( $logger, "Done persisting ChannelManager." ) ;
424424 }
@@ -481,10 +481,10 @@ macro_rules! define_run_body {
481481 }
482482
483483 if let Err ( e) = maybe_await!( $async_persist, $kv_store. write(
484- NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE ,
485- NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE ,
486- NETWORK_GRAPH_PERSISTENCE_KEY ,
487- & network_graph. encode( ) ,
484+ NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE . to_string ( ) ,
485+ NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE . to_string ( ) ,
486+ NETWORK_GRAPH_PERSISTENCE_KEY . to_string ( ) ,
487+ network_graph. encode( ) ,
488488 ) ) {
489489 log_error!( $logger, "Error: Failed to persist network graph, check your disk and permissions {}" , e)
490490 }
@@ -514,10 +514,10 @@ macro_rules! define_run_body {
514514 log_trace!( $logger, "Persisting scorer" ) ;
515515 }
516516 if let Err ( e) = maybe_await!( $async_persist, $kv_store. write(
517- SCORER_PERSISTENCE_PRIMARY_NAMESPACE ,
518- SCORER_PERSISTENCE_SECONDARY_NAMESPACE ,
519- SCORER_PERSISTENCE_KEY ,
520- & scorer. encode( ) ,
517+ SCORER_PERSISTENCE_PRIMARY_NAMESPACE . to_string ( ) ,
518+ SCORER_PERSISTENCE_SECONDARY_NAMESPACE . to_string ( ) ,
519+ SCORER_PERSISTENCE_KEY . to_string ( ) ,
520+ scorer. encode( ) ,
521521 ) ) {
522522 log_error!( $logger, "Error: Failed to persist scorer, check your disk and permissions {}" , e)
523523 }
@@ -542,29 +542,29 @@ macro_rules! define_run_body {
542542 // some races where users quit while channel updates were in-flight, with
543543 // ChannelMonitor update(s) persisted without a corresponding ChannelManager update.
544544 maybe_await!( $async_persist, $kv_store. write(
545- CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE ,
546- CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE ,
547- CHANNEL_MANAGER_PERSISTENCE_KEY ,
548- & $channel_manager. get_cm( ) . encode( ) ,
545+ CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE . to_string ( ) ,
546+ CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE . to_string ( ) ,
547+ CHANNEL_MANAGER_PERSISTENCE_KEY . to_string ( ) ,
548+ $channel_manager. get_cm( ) . encode( ) ,
549549 ) ) ?;
550550
551551 // Persist Scorer on exit
552552 if let Some ( ref scorer) = $scorer {
553553 maybe_await!( $async_persist, $kv_store. write(
554- SCORER_PERSISTENCE_PRIMARY_NAMESPACE ,
555- SCORER_PERSISTENCE_SECONDARY_NAMESPACE ,
556- SCORER_PERSISTENCE_KEY ,
557- & scorer. encode( ) ,
554+ SCORER_PERSISTENCE_PRIMARY_NAMESPACE . to_string ( ) ,
555+ SCORER_PERSISTENCE_SECONDARY_NAMESPACE . to_string ( ) ,
556+ SCORER_PERSISTENCE_KEY . to_string ( ) ,
557+ scorer. encode( ) ,
558558 ) ) ?;
559559 }
560560
561561 // Persist NetworkGraph on exit
562562 if let Some ( network_graph) = $gossip_sync. network_graph( ) {
563563 maybe_await!( $async_persist, $kv_store. write(
564- NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE ,
565- NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE ,
566- NETWORK_GRAPH_PERSISTENCE_KEY ,
567- & network_graph. encode( ) ,
564+ NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE . to_string ( ) ,
565+ NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE . to_string ( ) ,
566+ NETWORK_GRAPH_PERSISTENCE_KEY . to_string ( ) ,
567+ network_graph. encode( ) ,
568568 ) ) ?;
569569 }
570570
@@ -725,17 +725,17 @@ use futures_util::{dummy_waker, OptionalSelector, Selector, SelectorOutput};
725725/// # }
726726/// # struct StoreSync {}
727727/// # impl lightning::util::persist::KVStoreSync for StoreSync {
728- /// # fn read(&self, primary_namespace: &str , secondary_namespace: &str , key: &str ) -> io::Result<Vec<u8>> { Ok(Vec::new()) }
729- /// # fn write(&self, primary_namespace: &str , secondary_namespace: &str , key: &str , buf: &[u8] ) -> io::Result<()> { Ok(()) }
730- /// # fn remove(&self, primary_namespace: &str , secondary_namespace: &str , key: &str , lazy: bool) -> io::Result<()> { Ok(()) }
731- /// # fn list(&self, primary_namespace: &str , secondary_namespace: &str ) -> io::Result<Vec<String>> { Ok(Vec::new()) }
728+ /// # fn read(&self, primary_namespace: String , secondary_namespace: String , key: String ) -> io::Result<Vec<u8>> { Ok(Vec::new()) }
729+ /// # fn write(&self, primary_namespace: String , secondary_namespace: String , key: String , buf: Vec<u8> ) -> io::Result<()> { Ok(()) }
730+ /// # fn remove(&self, primary_namespace: String , secondary_namespace: String , key: String , lazy: bool) -> io::Result<()> { Ok(()) }
731+ /// # fn list(&self, primary_namespace: String , secondary_namespace: String ) -> io::Result<Vec<String>> { Ok(Vec::new()) }
732732/// # }
733733/// # struct Store {}
734734/// # impl lightning::util::persist::KVStore for Store {
735- /// # fn read(&self, primary_namespace: &str , secondary_namespace: &str , key: &str ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send>> { todo!() }
736- /// # fn write(&self, primary_namespace: &str , secondary_namespace: &str , key: &str , buf: &[u8] ) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + 'static + Send>> { todo!() }
737- /// # fn remove(&self, primary_namespace: &str , secondary_namespace: &str , key: &str , lazy: bool) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + 'static + Send>> { todo!() }
738- /// # fn list(&self, primary_namespace: &str , secondary_namespace: &str ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, io::Error>> + 'static + Send>> { todo!() }
735+ /// # fn read(&self, primary_namespace: String , secondary_namespace: String , key: String ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send>> { todo!() }
736+ /// # fn write(&self, primary_namespace: String , secondary_namespace: String , key: String , buf: Vec<u8> ) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + 'static + Send>> { todo!() }
737+ /// # fn remove(&self, primary_namespace: String , secondary_namespace: String , key: String , lazy: bool) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + 'static + Send>> { todo!() }
738+ /// # fn list(&self, primary_namespace: String , secondary_namespace: String ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, io::Error>> + 'static + Send>> { todo!() }
739739/// # }
740740/// # use core::time::Duration;
741741/// # struct DefaultTimeProvider;
@@ -927,10 +927,10 @@ where
927927 log_trace ! ( logger, "Persisting scorer after update" ) ;
928928 if let Err ( e) = kv_store
929929 . write (
930- SCORER_PERSISTENCE_PRIMARY_NAMESPACE ,
931- SCORER_PERSISTENCE_SECONDARY_NAMESPACE ,
932- SCORER_PERSISTENCE_KEY ,
933- & scorer. encode ( ) ,
930+ SCORER_PERSISTENCE_PRIMARY_NAMESPACE . to_string ( ) ,
931+ SCORER_PERSISTENCE_SECONDARY_NAMESPACE . to_string ( ) ,
932+ SCORER_PERSISTENCE_KEY . to_string ( ) ,
933+ scorer. encode ( ) ,
934934 )
935935 . await
936936 {
@@ -1206,10 +1206,10 @@ impl BackgroundProcessor {
12061206 if update_scorer ( scorer, & event, duration_since_epoch) {
12071207 log_trace ! ( logger, "Persisting scorer after update" ) ;
12081208 if let Err ( e) = kv_store. write (
1209- SCORER_PERSISTENCE_PRIMARY_NAMESPACE ,
1210- SCORER_PERSISTENCE_SECONDARY_NAMESPACE ,
1211- SCORER_PERSISTENCE_KEY ,
1212- & scorer. encode ( ) ,
1209+ SCORER_PERSISTENCE_PRIMARY_NAMESPACE . to_string ( ) ,
1210+ SCORER_PERSISTENCE_SECONDARY_NAMESPACE . to_string ( ) ,
1211+ SCORER_PERSISTENCE_KEY . to_string ( ) ,
1212+ scorer. encode ( ) ,
12131213 ) {
12141214 log_error ! ( logger, "Error: Failed to persist scorer, check your disk and permissions {}" , e)
12151215 }
@@ -1618,13 +1618,14 @@ mod tests {
16181618
16191619 impl KVStoreSync for Persister {
16201620 fn read (
1621- & self , primary_namespace : & str , secondary_namespace : & str , key : & str ,
1621+ & self , primary_namespace : String , secondary_namespace : String , key : String ,
16221622 ) -> lightning:: io:: Result < Vec < u8 > > {
16231623 self . kv_store . read ( primary_namespace, secondary_namespace, key)
16241624 }
16251625
16261626 fn write (
1627- & self , primary_namespace : & str , secondary_namespace : & str , key : & str , buf : & [ u8 ] ,
1627+ & self , primary_namespace : String , secondary_namespace : String , key : String ,
1628+ buf : Vec < u8 > ,
16281629 ) -> lightning:: io:: Result < ( ) > {
16291630 if primary_namespace == CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE
16301631 && secondary_namespace == CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE
@@ -1666,13 +1667,13 @@ mod tests {
16661667 }
16671668
16681669 fn remove (
1669- & self , primary_namespace : & str , secondary_namespace : & str , key : & str , lazy : bool ,
1670+ & self , primary_namespace : String , secondary_namespace : String , key : String , lazy : bool ,
16701671 ) -> lightning:: io:: Result < ( ) > {
16711672 self . kv_store . remove ( primary_namespace, secondary_namespace, key, lazy)
16721673 }
16731674
16741675 fn list (
1675- & self , primary_namespace : & str , secondary_namespace : & str ,
1676+ & self , primary_namespace : String , secondary_namespace : String ,
16761677 ) -> lightning:: io:: Result < Vec < String > > {
16771678 self . kv_store . list ( primary_namespace, secondary_namespace)
16781679 }
0 commit comments