6 namespace org { namespace ldk { namespace structs {
9 * Refers to a scorer that is accessible under lock and also writeable to disk
11 * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to
12 * use the Persister to persist it.
14 public class WriteableScore : CommonBase {
15 internal readonly bindings.LDKWriteableScore bindings_instance;
16 internal WriteableScore(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
17 private WriteableScore(bindings.LDKWriteableScore arg, bindings.LDKLockableScore LockableScore) : base(bindings.LDKWriteableScore_new(arg, LockableScore)) {
18 this.ptrs_to.AddLast(arg);
19 this.ptrs_to.AddLast(LockableScore);
20 this.bindings_instance = arg;
23 if (ptr != 0) { bindings.WriteableScore_free(ptr); }
26 public interface WriteableScoreInterface {
28 * Serialize the object into a byte array
32 private class LDKWriteableScoreHolder { internal WriteableScore held; }
33 private class LDKWriteableScoreImpl : bindings.LDKWriteableScore {
34 internal LDKWriteableScoreImpl(WriteableScoreInterface arg, LDKWriteableScoreHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
35 private WriteableScoreInterface arg;
36 private LDKWriteableScoreHolder impl_holder;
37 public byte[] write() {
38 byte[] ret = arg.write();
43 public static WriteableScore new_impl(WriteableScoreInterface arg, LockableScore.LockableScoreInterface LockableScore_impl) {
44 LDKWriteableScoreHolder impl_holder = new LDKWriteableScoreHolder();
45 impl_holder.held = new WriteableScore(new LDKWriteableScoreImpl(arg, impl_holder), LockableScore.new_impl(LockableScore_impl).bindings_instance);
46 return impl_holder.held;
50 * Gets the underlying LockableScore.
52 public LockableScore get_lockable_score() {
53 LockableScore res = new LockableScore(null, bindings.LDKWriteableScore_get_LockableScore(this.ptr));
54 this.ptrs_to.AddLast(res);
59 * Serialize the object into a byte array
61 public byte[] write() {
62 byte[] ret = bindings.WriteableScore_write(this.ptr);