3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class FilesystemPersister extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.FilesystemPersister_free(this.ptr);
21 public static FilesystemPersister constructor_new(Uint8Array path_to_channel_data) {
22 number ret = bindings.FilesystemPersister_new(path_to_channel_data);
23 const ret_hu_conv: FilesystemPersister = new FilesystemPersister(null, ret);
24 ret_hu_conv.ptrs_to.add(ret_hu_conv);
28 public Uint8Array get_data_dir() {
29 Uint8Array ret = bindings.FilesystemPersister_get_data_dir(this.ptr);
33 public static Result_NoneErrorZ constructor_persist_manager(Uint8Array data_dir, ChannelManager manager) {
34 number ret = bindings.FilesystemPersister_persist_manager(data_dir, manager == null ? 0 : manager.ptr & ~1);
35 Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret);
36 ret_hu_conv.ptrs_to.add(manager);
40 public Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ read_channelmonitors(KeysInterface keys_manager) {
41 number ret = bindings.FilesystemPersister_read_channelmonitors(this.ptr, keys_manager == null ? 0 : keys_manager.ptr);
42 Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret);
43 this.ptrs_to.add(keys_manager);
47 public Persist as_Persist() {
48 number ret = bindings.FilesystemPersister_as_Persist(this.ptr);
49 Persist ret_hu_conv = new Persist(null, ret);
50 ret_hu_conv.ptrs_to.add(this);