Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / ChannelMonitorUpdate.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  * An update generated by the underlying Channel itself which contains some new information the
13  * ChannelMonitor should be made aware of.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class ChannelMonitorUpdate extends CommonBase {
17         ChannelMonitorUpdate(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.ChannelMonitorUpdate_free(ptr); }
22         }
23
24         /**
25          * The sequence number of this update. Updates *must* be replayed in-order according to this
26          * sequence number (and updates may panic if they are not). The update_id values are strictly
27          * increasing and increase by one for each new update, with one exception specified below.
28          * 
29          * This sequence number is also used to track up to which points updates which returned
30          * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
31          * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
32          * 
33          * The only instance where update_id values are not strictly increasing is the case where we
34          * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
35          * its docs for more details.
36          */
37         public long get_update_id() {
38                 long ret = bindings.ChannelMonitorUpdate_get_update_id(this.ptr);
39                 Reference.reachabilityFence(this);
40                 return ret;
41         }
42
43         /**
44          * The sequence number of this update. Updates *must* be replayed in-order according to this
45          * sequence number (and updates may panic if they are not). The update_id values are strictly
46          * increasing and increase by one for each new update, with one exception specified below.
47          * 
48          * This sequence number is also used to track up to which points updates which returned
49          * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
50          * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
51          * 
52          * The only instance where update_id values are not strictly increasing is the case where we
53          * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
54          * its docs for more details.
55          */
56         public void set_update_id(long val) {
57                 bindings.ChannelMonitorUpdate_set_update_id(this.ptr, val);
58                 Reference.reachabilityFence(this);
59                 Reference.reachabilityFence(val);
60         }
61
62         long clone_ptr() {
63                 long ret = bindings.ChannelMonitorUpdate_clone_ptr(this.ptr);
64                 Reference.reachabilityFence(this);
65                 return ret;
66         }
67
68         /**
69          * Creates a copy of the ChannelMonitorUpdate
70          */
71         public ChannelMonitorUpdate clone() {
72                 long ret = bindings.ChannelMonitorUpdate_clone(this.ptr);
73                 Reference.reachabilityFence(this);
74                 if (ret >= 0 && ret <= 4096) { return null; }
75                 ChannelMonitorUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelMonitorUpdate(null, ret); }
76                 ret_hu_conv.ptrs_to.add(this);
77                 return ret_hu_conv;
78         }
79
80         /**
81          * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
82          */
83         public byte[] write() {
84                 byte[] ret = bindings.ChannelMonitorUpdate_write(this.ptr);
85                 Reference.reachabilityFence(this);
86                 return ret;
87         }
88
89         /**
90          * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
91          */
92         public static Result_ChannelMonitorUpdateDecodeErrorZ read(byte[] ser) {
93                 long ret = bindings.ChannelMonitorUpdate_read(ser);
94                 Reference.reachabilityFence(ser);
95                 if (ret >= 0 && ret <= 4096) { return null; }
96                 Result_ChannelMonitorUpdateDecodeErrorZ ret_hu_conv = Result_ChannelMonitorUpdateDecodeErrorZ.constr_from_ptr(ret);
97                 return ret_hu_conv;
98         }
99
100 }