1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * A [`KVStore`] implementation that writes to and reads from the file system.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class FilesystemStore extends CommonBase {
16 FilesystemStore(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.FilesystemStore_free(ptr); }
24 * Constructs a new [`FilesystemStore`].
26 public static FilesystemStore of(java.lang.String data_dir) {
27 long ret = bindings.FilesystemStore_new(data_dir);
28 Reference.reachabilityFence(data_dir);
29 if (ret >= 0 && ret <= 4096) { return null; }
30 org.ldk.structs.FilesystemStore ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FilesystemStore(null, ret); }
31 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
36 * Returns the data directory.
38 public String get_data_dir() {
39 String ret = bindings.FilesystemStore_get_data_dir(this.ptr);
40 Reference.reachabilityFence(this);
45 * Constructs a new KVStore which calls the relevant methods on this_arg.
46 * This copies the `inner` pointer in this_arg and thus the returned KVStore must be freed before this_arg is
48 public KVStore as_KVStore() {
49 long ret = bindings.FilesystemStore_as_KVStore(this.ptr);
50 Reference.reachabilityFence(this);
51 if (ret >= 0 && ret <= 4096) { return null; }
52 KVStore ret_hu_conv = new KVStore(null, ret);
53 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };