File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 11use lightning:: ln:: msgs:: { DecodeError , LightningError } ;
22
3+ /// All-encompassing standard error type that processing can return
34pub enum GraphSyncError {
5+ /// IO error wrapper, typically the result of an issue with the file system
46 IOError ( std:: io:: Error ) ,
7+ /// Error trying to read the update data, typically due to an erroneous data length indication
8+ /// that is greater than the actual amount of data provided
59 DecodeError ( DecodeError ) ,
10+ /// Error applying the patch to the network graph, usually the result of updates that are too
11+ /// old or missing prerequisite data to the application of updates out of order
612 LightningError ( LightningError ) ,
13+ /// Some other error whose nature is indicated in its descriptor string
714 ProcessingError ( String ) ,
815}
916
Original file line number Diff line number Diff line change 88#![ deny( unused_variables) ]
99#![ deny( unused_imports) ]
1010
11+ //! This crate exposes functionality to rapidly sync gossip data, aimed primarily at mobile
12+ //! devices.
13+
1114use std:: fs:: File ;
1215
1316use lightning:: routing:: network_graph;
1417
1518use crate :: error:: GraphSyncError ;
1619
20+ /// Error types that these functions can return
1721pub mod error;
22+
23+ /// Core functionality of this crate
1824pub mod processing;
1925
26+ /// Sync gossip data from a file
27+ ///
28+ /// `network_graph`: The network graph to apply the updates to
29+ ///
30+ /// `sync_path`: Path to the file where the gossip update data is located
31+ ///
2032pub fn sync_network_graph_with_file_path (
2133 network_graph : & network_graph:: NetworkGraph ,
2234 sync_path : & str ,
Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ use crate::error::GraphSyncError;
1919/// data receipt, as opposed to originally signed value. TODO: TBD
2020const TIMESTAMP_RETROGRESSION_DELTA : u32 = 7 * 24 * 3600 ;
2121
22+ /// Update network graph from binary data
23+ ///
24+ /// `network_graph`: network graph to be updated
25+ ///
26+ /// `update_data`: `&[u8]` binary stream that comprises the update data
2227pub fn update_network_graph (
2328 network_graph : & network_graph:: NetworkGraph ,
2429 update_data : & [ u8 ] ,
You can’t perform that action at this time.
0 commit comments