[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / RapidGossipSync.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * The main Rapid Gossip Sync object.
13  * 
14  * See [crate-level documentation] for usage.
15  * 
16  * [crate-level documentation]: crate
17  */
18 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
19 public class RapidGossipSync extends CommonBase {
20         RapidGossipSync(Object _dummy, long ptr) { super(ptr); }
21         @Override @SuppressWarnings("deprecation")
22         protected void finalize() throws Throwable {
23                 super.finalize();
24                 if (ptr != 0) { bindings.RapidGossipSync_free(ptr); }
25         }
26
27         /**
28          * Instantiate a new [`RapidGossipSync`] instance.
29          */
30         public static RapidGossipSync of(NetworkGraph network_graph) {
31                 long ret = bindings.RapidGossipSync_new(network_graph == null ? 0 : network_graph.ptr);
32                 Reference.reachabilityFence(network_graph);
33                 if (ret >= 0 && ret <= 4096) { return null; }
34                 org.ldk.structs.RapidGossipSync ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RapidGossipSync(null, ret); }
35                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
36                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); };
37                 return ret_hu_conv;
38         }
39
40         /**
41          * Update network graph from binary data.
42          * Returns the last sync timestamp to be used the next time rapid sync data is queried.
43          * 
44          * `network_graph`: network graph to be updated
45          * 
46          * `update_data`: `&[u8]` binary stream that comprises the update data
47          */
48         public Result_u32GraphSyncErrorZ update_network_graph(byte[] update_data) {
49                 long ret = bindings.RapidGossipSync_update_network_graph(this.ptr, update_data);
50                 Reference.reachabilityFence(this);
51                 Reference.reachabilityFence(update_data);
52                 if (ret >= 0 && ret <= 4096) { return null; }
53                 Result_u32GraphSyncErrorZ ret_hu_conv = Result_u32GraphSyncErrorZ.constr_from_ptr(ret);
54                 return ret_hu_conv;
55         }
56
57         /**
58          * Returns whether a rapid gossip sync has completed at least once.
59          */
60         public boolean is_initial_sync_complete() {
61                 boolean ret = bindings.RapidGossipSync_is_initial_sync_complete(this.ptr);
62                 Reference.reachabilityFence(this);
63                 return ret;
64         }
65
66 }