[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / RapidGossipSync.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * The main Rapid Gossip Sync object.
11  * 
12  * See [crate-level documentation] for usage.
13  * 
14  * [crate-level documentation]: crate
15  */
16 public class RapidGossipSync : CommonBase {
17         internal RapidGossipSync(object _dummy, long ptr) : base(ptr) { }
18         ~RapidGossipSync() {
19                 if (ptr != 0) { bindings.RapidGossipSync_free(ptr); }
20         }
21
22         /**
23          * Instantiate a new [`RapidGossipSync`] instance.
24          */
25         public static RapidGossipSync of(org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Logger logger) {
26                 long ret = bindings.RapidGossipSync_new(network_graph == null ? 0 : network_graph.ptr, logger.ptr);
27                 GC.KeepAlive(network_graph);
28                 GC.KeepAlive(logger);
29                 if (ret >= 0 && ret <= 4096) { return null; }
30                 org.ldk.structs.RapidGossipSync ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RapidGossipSync(null, ret); }
31                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
32                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(network_graph); };
33                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(logger); };
34                 return ret_hu_conv;
35         }
36
37         /**
38          * Sync gossip data from a file.
39          * Returns the last sync timestamp to be used the next time rapid sync data is queried.
40          * 
41          * `network_graph`: The network graph to apply the updates to
42          * 
43          * `sync_path`: Path to the file where the gossip update data is located
44          */
45         public Result_u32GraphSyncErrorZ sync_network_graph_with_file_path(string sync_path) {
46                 long ret = bindings.RapidGossipSync_sync_network_graph_with_file_path(this.ptr, InternalUtils.encodeString(sync_path));
47                 GC.KeepAlive(this);
48                 GC.KeepAlive(sync_path);
49                 if (ret >= 0 && ret <= 4096) { return null; }
50                 Result_u32GraphSyncErrorZ ret_hu_conv = Result_u32GraphSyncErrorZ.constr_from_ptr(ret);
51                 return ret_hu_conv;
52         }
53
54         /**
55          * Update network graph from binary data.
56          * Returns the last sync timestamp to be used the next time rapid sync data is queried.
57          * 
58          * `update_data`: `&[u8]` binary stream that comprises the update data
59          */
60         public Result_u32GraphSyncErrorZ update_network_graph(byte[] update_data) {
61                 long ret = bindings.RapidGossipSync_update_network_graph(this.ptr, InternalUtils.encodeUint8Array(update_data));
62                 GC.KeepAlive(this);
63                 GC.KeepAlive(update_data);
64                 if (ret >= 0 && ret <= 4096) { return null; }
65                 Result_u32GraphSyncErrorZ ret_hu_conv = Result_u32GraphSyncErrorZ.constr_from_ptr(ret);
66                 return ret_hu_conv;
67         }
68
69         /**
70          * Update network graph from binary data.
71          * Returns the last sync timestamp to be used the next time rapid sync data is queried.
72          * 
73          * `update_data`: `&[u8]` binary stream that comprises the update data
74          * `current_time_unix`: `Option<u64>` optional current timestamp to verify data age
75          */
76         public Result_u32GraphSyncErrorZ update_network_graph_no_std(byte[] update_data, org.ldk.structs.Option_u64Z current_time_unix) {
77                 long ret = bindings.RapidGossipSync_update_network_graph_no_std(this.ptr, InternalUtils.encodeUint8Array(update_data), current_time_unix.ptr);
78                 GC.KeepAlive(this);
79                 GC.KeepAlive(update_data);
80                 GC.KeepAlive(current_time_unix);
81                 if (ret >= 0 && ret <= 4096) { return null; }
82                 Result_u32GraphSyncErrorZ ret_hu_conv = Result_u32GraphSyncErrorZ.constr_from_ptr(ret);
83                 if (this != null) { this.ptrs_to.AddLast(current_time_unix); };
84                 return ret_hu_conv;
85         }
86
87         /**
88          * Returns whether a rapid gossip sync has completed at least once.
89          */
90         public bool is_initial_sync_complete() {
91                 bool ret = bindings.RapidGossipSync_is_initial_sync_complete(this.ptr);
92                 GC.KeepAlive(this);
93                 return ret;
94         }
95
96 }
97 } } }