]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/BackgroundProcessor.ts
Merge pull request #50 from TheBlueMatt/main
[ldk-java] / ts / structs / BackgroundProcessor.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export default class BackgroundProcessor extends CommonBase {
9                 constructor(_dummy: object, ptr: number) {
10                     super(ptr);
11                 }
12
13                 
14                 protected finalize() {
15                     super.finalize();
16
17                     if (this.ptr != 0) {
18                         bindings.BackgroundProcessor_free(this.ptr);
19                     }
20                 }
21         public static BackgroundProcessor constructor_start(ChannelManagerPersister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, NetGraphMsgHandler net_graph_msg_handler, PeerManager peer_manager, Logger logger) {
22                 number ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr & ~1, channel_manager == null ? 0 : channel_manager.ptr & ~1, net_graph_msg_handler == null ? 0 : net_graph_msg_handler.ptr & ~1, peer_manager == null ? 0 : peer_manager.ptr & ~1, logger == null ? 0 : logger.ptr);
23                 const ret_hu_conv: BackgroundProcessor = new BackgroundProcessor(null, ret);
24                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
25                 ret_hu_conv.ptrs_to.add(persister);
26                 ret_hu_conv.ptrs_to.add(event_handler);
27                 ret_hu_conv.ptrs_to.add(chain_monitor);
28                 ret_hu_conv.ptrs_to.add(channel_manager);
29                 ret_hu_conv.ptrs_to.add(net_graph_msg_handler);
30                 ret_hu_conv.ptrs_to.add(peer_manager);
31                 ret_hu_conv.ptrs_to.add(logger);
32                 return ret_hu_conv;
33         }
34
35         public Result_NoneErrorZ join() {
36                 number ret = bindings.BackgroundProcessor_join(this.ptr);
37                 Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret);
38                 return ret_hu_conv;
39         }
40
41         public Result_NoneErrorZ stop() {
42                 number ret = bindings.BackgroundProcessor_stop(this.ptr);
43                 Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret);
44                 return ret_hu_conv;
45         }
46
47 }