-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMiningPoolService.java
More file actions
4851 lines (4168 loc) · 173 KB
/
Copy pathMiningPoolService.java
File metadata and controls
4851 lines (4168 loc) · 173 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Autogenerated by Thrift Compiler (0.22.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.22.0)", date = "2025-09-29")
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
public class MiningPoolService {
public interface Iface {
public long mineBlock(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target) throws IllegalArgument, org.apache.thrift.TException;
public void cancel() throws org.apache.thrift.TException;
public void registerBEServer(java.lang.String host, int port, int cores) throws org.apache.thrift.TException;
public long mineBlockWithRange(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target, long startNonce, long endNonce) throws org.apache.thrift.TException;
}
public interface AsyncIface {
public void mineBlock(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> resultHandler) throws org.apache.thrift.TException;
public void cancel(org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException;
public void registerBEServer(java.lang.String host, int port, int cores, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException;
public void mineBlockWithRange(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target, long startNonce, long endNonce, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> resultHandler) throws org.apache.thrift.TException;
}
public static class Client extends org.apache.thrift.TServiceClient implements Iface {
public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
public Factory() {}
@Override
public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
return new Client(prot);
}
@Override
public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
return new Client(iprot, oprot);
}
}
public Client(org.apache.thrift.protocol.TProtocol prot)
{
super(prot, prot);
}
public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
super(iprot, oprot);
}
@Override
public long mineBlock(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target) throws IllegalArgument, org.apache.thrift.TException
{
send_mineBlock(version, prevBlockHash, merkleRootHash, time, target);
return recv_mineBlock();
}
public void send_mineBlock(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target) throws org.apache.thrift.TException
{
mineBlock_args args = new mineBlock_args();
args.setVersion(version);
args.setPrevBlockHash(prevBlockHash);
args.setMerkleRootHash(merkleRootHash);
args.setTime(time);
args.setTarget(target);
sendBase("mineBlock", args);
}
public long recv_mineBlock() throws IllegalArgument, org.apache.thrift.TException
{
mineBlock_result result = new mineBlock_result();
receiveBase(result, "mineBlock");
if (result.isSetSuccess()) {
return result.success;
}
if (result.e != null) {
throw result.e;
}
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "mineBlock failed: unknown result");
}
@Override
public void cancel() throws org.apache.thrift.TException
{
send_cancel();
recv_cancel();
}
public void send_cancel() throws org.apache.thrift.TException
{
cancel_args args = new cancel_args();
sendBase("cancel", args);
}
public void recv_cancel() throws org.apache.thrift.TException
{
cancel_result result = new cancel_result();
receiveBase(result, "cancel");
return;
}
@Override
public void registerBEServer(java.lang.String host, int port, int cores) throws org.apache.thrift.TException
{
send_registerBEServer(host, port, cores);
recv_registerBEServer();
}
public void send_registerBEServer(java.lang.String host, int port, int cores) throws org.apache.thrift.TException
{
registerBEServer_args args = new registerBEServer_args();
args.setHost(host);
args.setPort(port);
args.setCores(cores);
sendBase("registerBEServer", args);
}
public void recv_registerBEServer() throws org.apache.thrift.TException
{
registerBEServer_result result = new registerBEServer_result();
receiveBase(result, "registerBEServer");
return;
}
@Override
public long mineBlockWithRange(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target, long startNonce, long endNonce) throws org.apache.thrift.TException
{
send_mineBlockWithRange(version, prevBlockHash, merkleRootHash, time, target, startNonce, endNonce);
return recv_mineBlockWithRange();
}
public void send_mineBlockWithRange(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target, long startNonce, long endNonce) throws org.apache.thrift.TException
{
mineBlockWithRange_args args = new mineBlockWithRange_args();
args.setVersion(version);
args.setPrevBlockHash(prevBlockHash);
args.setMerkleRootHash(merkleRootHash);
args.setTime(time);
args.setTarget(target);
args.setStartNonce(startNonce);
args.setEndNonce(endNonce);
sendBase("mineBlockWithRange", args);
}
public long recv_mineBlockWithRange() throws org.apache.thrift.TException
{
mineBlockWithRange_result result = new mineBlockWithRange_result();
receiveBase(result, "mineBlockWithRange");
if (result.isSetSuccess()) {
return result.success;
}
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "mineBlockWithRange failed: unknown result");
}
}
public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
private org.apache.thrift.async.TAsyncClientManager clientManager;
private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
this.clientManager = clientManager;
this.protocolFactory = protocolFactory;
}
@Override
public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
return new AsyncClient(protocolFactory, clientManager, transport);
}
}
public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
super(protocolFactory, clientManager, transport);
}
@Override
public void mineBlock(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> resultHandler) throws org.apache.thrift.TException {
checkReady();
mineBlock_call method_call = new mineBlock_call(version, prevBlockHash, merkleRootHash, time, target, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class mineBlock_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.Long> {
private int version;
private java.nio.ByteBuffer prevBlockHash;
private java.nio.ByteBuffer merkleRootHash;
private long time;
private long target;
public mineBlock_call(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.version = version;
this.prevBlockHash = prevBlockHash;
this.merkleRootHash = merkleRootHash;
this.time = time;
this.target = target;
}
@Override
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("mineBlock", org.apache.thrift.protocol.TMessageType.CALL, 0));
mineBlock_args args = new mineBlock_args();
args.setVersion(version);
args.setPrevBlockHash(prevBlockHash);
args.setMerkleRootHash(merkleRootHash);
args.setTime(time);
args.setTarget(target);
args.write(prot);
prot.writeMessageEnd();
}
@Override
public java.lang.Long getResult() throws IllegalArgument, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new java.lang.IllegalStateException("Method call not finished!");
}
org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
return (new Client(prot)).recv_mineBlock();
}
}
@Override
public void cancel(org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException {
checkReady();
cancel_call method_call = new cancel_call(resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class cancel_call extends org.apache.thrift.async.TAsyncMethodCall<Void> {
public cancel_call(org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
}
@Override
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("cancel", org.apache.thrift.protocol.TMessageType.CALL, 0));
cancel_args args = new cancel_args();
args.write(prot);
prot.writeMessageEnd();
}
@Override
public Void getResult() throws org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new java.lang.IllegalStateException("Method call not finished!");
}
org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
(new Client(prot)).recv_cancel();
return null;
}
}
@Override
public void registerBEServer(java.lang.String host, int port, int cores, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException {
checkReady();
registerBEServer_call method_call = new registerBEServer_call(host, port, cores, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class registerBEServer_call extends org.apache.thrift.async.TAsyncMethodCall<Void> {
private java.lang.String host;
private int port;
private int cores;
public registerBEServer_call(java.lang.String host, int port, int cores, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.host = host;
this.port = port;
this.cores = cores;
}
@Override
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("registerBEServer", org.apache.thrift.protocol.TMessageType.CALL, 0));
registerBEServer_args args = new registerBEServer_args();
args.setHost(host);
args.setPort(port);
args.setCores(cores);
args.write(prot);
prot.writeMessageEnd();
}
@Override
public Void getResult() throws org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new java.lang.IllegalStateException("Method call not finished!");
}
org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
(new Client(prot)).recv_registerBEServer();
return null;
}
}
@Override
public void mineBlockWithRange(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target, long startNonce, long endNonce, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> resultHandler) throws org.apache.thrift.TException {
checkReady();
mineBlockWithRange_call method_call = new mineBlockWithRange_call(version, prevBlockHash, merkleRootHash, time, target, startNonce, endNonce, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class mineBlockWithRange_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.Long> {
private int version;
private java.nio.ByteBuffer prevBlockHash;
private java.nio.ByteBuffer merkleRootHash;
private long time;
private long target;
private long startNonce;
private long endNonce;
public mineBlockWithRange_call(int version, java.nio.ByteBuffer prevBlockHash, java.nio.ByteBuffer merkleRootHash, long time, long target, long startNonce, long endNonce, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.version = version;
this.prevBlockHash = prevBlockHash;
this.merkleRootHash = merkleRootHash;
this.time = time;
this.target = target;
this.startNonce = startNonce;
this.endNonce = endNonce;
}
@Override
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("mineBlockWithRange", org.apache.thrift.protocol.TMessageType.CALL, 0));
mineBlockWithRange_args args = new mineBlockWithRange_args();
args.setVersion(version);
args.setPrevBlockHash(prevBlockHash);
args.setMerkleRootHash(merkleRootHash);
args.setTime(time);
args.setTarget(target);
args.setStartNonce(startNonce);
args.setEndNonce(endNonce);
args.write(prot);
prot.writeMessageEnd();
}
@Override
public java.lang.Long getResult() throws org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new java.lang.IllegalStateException("Method call not finished!");
}
org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
return (new Client(prot)).recv_mineBlockWithRange();
}
}
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(Processor.class.getName());
public Processor(I iface) {
super(iface, getProcessMap(new java.util.HashMap<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase, ? extends org.apache.thrift.TBase>>()));
}
protected Processor(I iface, java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase, ? extends org.apache.thrift.TBase>> processMap) {
super(iface, getProcessMap(processMap));
}
private static <I extends Iface> java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase, ? extends org.apache.thrift.TBase>> getProcessMap(java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase, ? extends org.apache.thrift.TBase>> processMap) {
processMap.put("mineBlock", new mineBlock());
processMap.put("cancel", new cancel());
processMap.put("registerBEServer", new registerBEServer());
processMap.put("mineBlockWithRange", new mineBlockWithRange());
return processMap;
}
public static class mineBlock<I extends Iface> extends org.apache.thrift.ProcessFunction<I, mineBlock_args, mineBlock_result> {
public mineBlock() {
super("mineBlock");
}
@Override
public mineBlock_args getEmptyArgsInstance() {
return new mineBlock_args();
}
@Override
public boolean isOneway() {
return false;
}
@Override
protected boolean rethrowUnhandledExceptions() {
return false;
}
@Override
public mineBlock_result getEmptyResultInstance() {
return new mineBlock_result();
}
@Override
public mineBlock_result getResult(I iface, mineBlock_args args) throws org.apache.thrift.TException {
mineBlock_result result = getEmptyResultInstance();
try {
result.success = iface.mineBlock(args.version, args.prevBlockHash, args.merkleRootHash, args.time, args.target);
result.setSuccessIsSet(true);
} catch (IllegalArgument e) {
result.e = e;
}
return result;
}
}
public static class cancel<I extends Iface> extends org.apache.thrift.ProcessFunction<I, cancel_args, cancel_result> {
public cancel() {
super("cancel");
}
@Override
public cancel_args getEmptyArgsInstance() {
return new cancel_args();
}
@Override
public boolean isOneway() {
return false;
}
@Override
protected boolean rethrowUnhandledExceptions() {
return false;
}
@Override
public cancel_result getEmptyResultInstance() {
return new cancel_result();
}
@Override
public cancel_result getResult(I iface, cancel_args args) throws org.apache.thrift.TException {
cancel_result result = getEmptyResultInstance();
iface.cancel();
return result;
}
}
public static class registerBEServer<I extends Iface> extends org.apache.thrift.ProcessFunction<I, registerBEServer_args, registerBEServer_result> {
public registerBEServer() {
super("registerBEServer");
}
@Override
public registerBEServer_args getEmptyArgsInstance() {
return new registerBEServer_args();
}
@Override
public boolean isOneway() {
return false;
}
@Override
protected boolean rethrowUnhandledExceptions() {
return false;
}
@Override
public registerBEServer_result getEmptyResultInstance() {
return new registerBEServer_result();
}
@Override
public registerBEServer_result getResult(I iface, registerBEServer_args args) throws org.apache.thrift.TException {
registerBEServer_result result = getEmptyResultInstance();
iface.registerBEServer(args.host, args.port, args.cores);
return result;
}
}
public static class mineBlockWithRange<I extends Iface> extends org.apache.thrift.ProcessFunction<I, mineBlockWithRange_args, mineBlockWithRange_result> {
public mineBlockWithRange() {
super("mineBlockWithRange");
}
@Override
public mineBlockWithRange_args getEmptyArgsInstance() {
return new mineBlockWithRange_args();
}
@Override
public boolean isOneway() {
return false;
}
@Override
protected boolean rethrowUnhandledExceptions() {
return false;
}
@Override
public mineBlockWithRange_result getEmptyResultInstance() {
return new mineBlockWithRange_result();
}
@Override
public mineBlockWithRange_result getResult(I iface, mineBlockWithRange_args args) throws org.apache.thrift.TException {
mineBlockWithRange_result result = getEmptyResultInstance();
result.success = iface.mineBlockWithRange(args.version, args.prevBlockHash, args.merkleRootHash, args.time, args.target, args.startNonce, args.endNonce);
result.setSuccessIsSet(true);
return result;
}
}
}
public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName());
public AsyncProcessor(I iface) {
super(iface, getProcessMap(new java.util.HashMap<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?, ? extends org.apache.thrift.TBase>>()));
}
protected AsyncProcessor(I iface, java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?, ? extends org.apache.thrift.TBase>> processMap) {
super(iface, getProcessMap(processMap));
}
private static <I extends AsyncIface> java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?, ? extends org.apache.thrift.TBase>> getProcessMap(java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?, ? extends org.apache.thrift.TBase>> processMap) {
processMap.put("mineBlock", new mineBlock());
processMap.put("cancel", new cancel());
processMap.put("registerBEServer", new registerBEServer());
processMap.put("mineBlockWithRange", new mineBlockWithRange());
return processMap;
}
public static class mineBlock<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, mineBlock_args, java.lang.Long, mineBlock_result> {
public mineBlock() {
super("mineBlock");
}
@Override
public mineBlock_result getEmptyResultInstance() {
return new mineBlock_result();
}
@Override
public mineBlock_args getEmptyArgsInstance() {
return new mineBlock_args();
}
@Override
public org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
return new org.apache.thrift.async.AsyncMethodCallback<java.lang.Long>() {
@Override
public void onComplete(java.lang.Long o) {
mineBlock_result result = new mineBlock_result();
result.success = o;
result.setSuccessIsSet(true);
try {
fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
} catch (org.apache.thrift.transport.TTransportException e) {
_LOGGER.error("TTransportException writing to internal frame buffer", e);
fb.close();
} catch (java.lang.Exception e) {
_LOGGER.error("Exception writing to internal frame buffer", e);
onError(e);
}
}
@Override
public void onError(java.lang.Exception e) {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TSerializable msg;
mineBlock_result result = new mineBlock_result();
if (e instanceof IllegalArgument) {
result.e = (IllegalArgument) e;
result.setEIsSet(true);
msg = result;
} else if (e instanceof org.apache.thrift.transport.TTransportException) {
_LOGGER.error("TTransportException inside handler", e);
fb.close();
return;
} else if (e instanceof org.apache.thrift.TApplicationException) {
_LOGGER.error("TApplicationException inside handler", e);
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TApplicationException)e;
} else {
_LOGGER.error("Exception inside handler", e);
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
} catch (java.lang.Exception ex) {
_LOGGER.error("Exception writing to internal frame buffer", ex);
fb.close();
}
}
};
}
@Override
public boolean isOneway() {
return false;
}
@Override
public void start(I iface, mineBlock_args args, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> resultHandler) throws org.apache.thrift.TException {
iface.mineBlock(args.version, args.prevBlockHash, args.merkleRootHash, args.time, args.target,resultHandler);
}
}
public static class cancel<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, cancel_args, Void, cancel_result> {
public cancel() {
super("cancel");
}
@Override
public cancel_result getEmptyResultInstance() {
return new cancel_result();
}
@Override
public cancel_args getEmptyArgsInstance() {
return new cancel_args();
}
@Override
public org.apache.thrift.async.AsyncMethodCallback<Void> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
return new org.apache.thrift.async.AsyncMethodCallback<Void>() {
@Override
public void onComplete(Void o) {
cancel_result result = new cancel_result();
try {
fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
} catch (org.apache.thrift.transport.TTransportException e) {
_LOGGER.error("TTransportException writing to internal frame buffer", e);
fb.close();
} catch (java.lang.Exception e) {
_LOGGER.error("Exception writing to internal frame buffer", e);
onError(e);
}
}
@Override
public void onError(java.lang.Exception e) {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TSerializable msg;
cancel_result result = new cancel_result();
if (e instanceof org.apache.thrift.transport.TTransportException) {
_LOGGER.error("TTransportException inside handler", e);
fb.close();
return;
} else if (e instanceof org.apache.thrift.TApplicationException) {
_LOGGER.error("TApplicationException inside handler", e);
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TApplicationException)e;
} else {
_LOGGER.error("Exception inside handler", e);
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
} catch (java.lang.Exception ex) {
_LOGGER.error("Exception writing to internal frame buffer", ex);
fb.close();
}
}
};
}
@Override
public boolean isOneway() {
return false;
}
@Override
public void start(I iface, cancel_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException {
iface.cancel(resultHandler);
}
}
public static class registerBEServer<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, registerBEServer_args, Void, registerBEServer_result> {
public registerBEServer() {
super("registerBEServer");
}
@Override
public registerBEServer_result getEmptyResultInstance() {
return new registerBEServer_result();
}
@Override
public registerBEServer_args getEmptyArgsInstance() {
return new registerBEServer_args();
}
@Override
public org.apache.thrift.async.AsyncMethodCallback<Void> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
return new org.apache.thrift.async.AsyncMethodCallback<Void>() {
@Override
public void onComplete(Void o) {
registerBEServer_result result = new registerBEServer_result();
try {
fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
} catch (org.apache.thrift.transport.TTransportException e) {
_LOGGER.error("TTransportException writing to internal frame buffer", e);
fb.close();
} catch (java.lang.Exception e) {
_LOGGER.error("Exception writing to internal frame buffer", e);
onError(e);
}
}
@Override
public void onError(java.lang.Exception e) {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TSerializable msg;
registerBEServer_result result = new registerBEServer_result();
if (e instanceof org.apache.thrift.transport.TTransportException) {
_LOGGER.error("TTransportException inside handler", e);
fb.close();
return;
} else if (e instanceof org.apache.thrift.TApplicationException) {
_LOGGER.error("TApplicationException inside handler", e);
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TApplicationException)e;
} else {
_LOGGER.error("Exception inside handler", e);
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
} catch (java.lang.Exception ex) {
_LOGGER.error("Exception writing to internal frame buffer", ex);
fb.close();
}
}
};
}
@Override
public boolean isOneway() {
return false;
}
@Override
public void start(I iface, registerBEServer_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException {
iface.registerBEServer(args.host, args.port, args.cores,resultHandler);
}
}
public static class mineBlockWithRange<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, mineBlockWithRange_args, java.lang.Long, mineBlockWithRange_result> {
public mineBlockWithRange() {
super("mineBlockWithRange");
}
@Override
public mineBlockWithRange_result getEmptyResultInstance() {
return new mineBlockWithRange_result();
}
@Override
public mineBlockWithRange_args getEmptyArgsInstance() {
return new mineBlockWithRange_args();
}
@Override
public org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
return new org.apache.thrift.async.AsyncMethodCallback<java.lang.Long>() {
@Override
public void onComplete(java.lang.Long o) {
mineBlockWithRange_result result = new mineBlockWithRange_result();
result.success = o;
result.setSuccessIsSet(true);
try {
fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
} catch (org.apache.thrift.transport.TTransportException e) {
_LOGGER.error("TTransportException writing to internal frame buffer", e);
fb.close();
} catch (java.lang.Exception e) {
_LOGGER.error("Exception writing to internal frame buffer", e);
onError(e);
}
}
@Override
public void onError(java.lang.Exception e) {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TSerializable msg;
mineBlockWithRange_result result = new mineBlockWithRange_result();
if (e instanceof org.apache.thrift.transport.TTransportException) {
_LOGGER.error("TTransportException inside handler", e);
fb.close();
return;
} else if (e instanceof org.apache.thrift.TApplicationException) {
_LOGGER.error("TApplicationException inside handler", e);
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TApplicationException)e;
} else {
_LOGGER.error("Exception inside handler", e);
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
} catch (java.lang.Exception ex) {
_LOGGER.error("Exception writing to internal frame buffer", ex);
fb.close();
}
}
};
}
@Override
public boolean isOneway() {
return false;
}
@Override
public void start(I iface, mineBlockWithRange_args args, org.apache.thrift.async.AsyncMethodCallback<java.lang.Long> resultHandler) throws org.apache.thrift.TException {
iface.mineBlockWithRange(args.version, args.prevBlockHash, args.merkleRootHash, args.time, args.target, args.startNonce, args.endNonce,resultHandler);
}
}
}
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
public static class mineBlock_args implements org.apache.thrift.TBase<mineBlock_args, mineBlock_args._Fields>, java.io.Serializable, Cloneable, Comparable<mineBlock_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("mineBlock_args");
private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField PREV_BLOCK_HASH_FIELD_DESC = new org.apache.thrift.protocol.TField("prevBlockHash", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField MERKLE_ROOT_HASH_FIELD_DESC = new org.apache.thrift.protocol.TField("merkleRootHash", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("time", org.apache.thrift.protocol.TType.I64, (short)4);
private static final org.apache.thrift.protocol.TField TARGET_FIELD_DESC = new org.apache.thrift.protocol.TField("target", org.apache.thrift.protocol.TType.I64, (short)5);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new mineBlock_argsStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new mineBlock_argsTupleSchemeFactory();
public int version; // required
public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer prevBlockHash; // required
public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer merkleRootHash; // required
public long time; // required
public long target; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
VERSION((short)1, "version"),
PREV_BLOCK_HASH((short)2, "prevBlockHash"),
MERKLE_ROOT_HASH((short)3, "merkleRootHash"),
TIME((short)4, "time"),
TARGET((short)5, "target");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
static {
for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
@org.apache.thrift.annotation.Nullable
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // VERSION
return VERSION;
case 2: // PREV_BLOCK_HASH
return PREV_BLOCK_HASH;
case 3: // MERKLE_ROOT_HASH
return MERKLE_ROOT_HASH;
case 4: // TIME
return TIME;
case 5: // TARGET
return TARGET;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
@org.apache.thrift.annotation.Nullable
public static _Fields findByName(java.lang.String name) {
return byName.get(name);
}
private final short _thriftId;
private final java.lang.String _fieldName;
_Fields(short thriftId, java.lang.String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
@Override
public short getThriftFieldId() {
return _thriftId;
}
@Override
public java.lang.String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __VERSION_ISSET_ID = 0;
private static final int __TIME_ISSET_ID = 1;
private static final int __TARGET_ISSET_ID = 2;
private byte __isset_bitfield = 0;
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.PREV_BLOCK_HASH, new org.apache.thrift.meta_data.FieldMetaData("prevBlockHash", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.MERKLE_ROOT_HASH, new org.apache.thrift.meta_data.FieldMetaData("merkleRootHash", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.TIME, new org.apache.thrift.meta_data.FieldMetaData("time", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.TARGET, new org.apache.thrift.meta_data.FieldMetaData("target", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(mineBlock_args.class, metaDataMap);
}
public mineBlock_args() {
}
public mineBlock_args(
int version,
java.nio.ByteBuffer prevBlockHash,
java.nio.ByteBuffer merkleRootHash,
long time,
long target)
{
this();
this.version = version;
setVersionIsSet(true);
this.prevBlockHash = org.apache.thrift.TBaseHelper.copyBinary(prevBlockHash);
this.merkleRootHash = org.apache.thrift.TBaseHelper.copyBinary(merkleRootHash);
this.time = time;
setTimeIsSet(true);
this.target = target;
setTargetIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public mineBlock_args(mineBlock_args other) {
__isset_bitfield = other.__isset_bitfield;
this.version = other.version;
if (other.isSetPrevBlockHash()) {
this.prevBlockHash = org.apache.thrift.TBaseHelper.copyBinary(other.prevBlockHash);
}
if (other.isSetMerkleRootHash()) {
this.merkleRootHash = org.apache.thrift.TBaseHelper.copyBinary(other.merkleRootHash);
}
this.time = other.time;
this.target = other.target;
}
@Override
public mineBlock_args deepCopy() {
return new mineBlock_args(this);
}
@Override
public void clear() {
setVersionIsSet(false);
this.version = 0;
this.prevBlockHash = null;
this.merkleRootHash = null;
setTimeIsSet(false);
this.time = 0;
setTargetIsSet(false);
this.target = 0;
}
public int getVersion() {
return this.version;
}
public mineBlock_args setVersion(int version) {