-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
BlockMasterWorkerService.java
5243 lines (4549 loc) · 186 KB
/
BlockMasterWorkerService.java
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.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package alluxio.thrift;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-11")
public class BlockMasterWorkerService {
/**
* This interface contains block master service endpoints for Alluxio workers.
*/
public interface Iface extends alluxio.thrift.AlluxioService.Iface {
/**
* Marks the given block as committed.
*
* @param workerId the id of the worker
*
* @param usedBytesOnTier the space used in bytes on the target tier
*
* @param tierAlias the alias of the target tier
*
* @param blockId the id of the block being committed
*
* @param length the length of the block being committed
*/
public void commitBlock(long workerId, long usedBytesOnTier, String tierAlias, long blockId, long length) throws org.apache.thrift.TException;
/**
* Returns a worker id for the given network address.
*
* @param workerNetAddress the worker network address
*/
public long getWorkerId(alluxio.thrift.WorkerNetAddress workerNetAddress) throws org.apache.thrift.TException;
/**
* Periodic worker heartbeat returns an optional command for the worker to execute.
*
* @param workerId the id of the worker
*
* @param usedBytesOnTiers the map of space used in bytes on all tiers
*
* @param removedBlockIds the list of removed block ids
*
* @param addedBlocksOnTiers the map of added blocks on all tiers
*/
public alluxio.thrift.Command heartbeat(long workerId, Map<String,Long> usedBytesOnTiers, List<Long> removedBlockIds, Map<String,List<Long>> addedBlocksOnTiers) throws org.apache.thrift.TException;
/**
* Registers a worker.
*
* @param workerId the id of the worker
*
* @param storageTiers the list of storage tiers
*
* @param totalBytesOnTiers the map of total bytes on each tier
*
* @param usedBytesOnTiers the map of used bytes on each tier
*
* @param currentBlocksOnTiers the map of list of blocks on each tier
*/
public void registerWorker(long workerId, List<String> storageTiers, Map<String,Long> totalBytesOnTiers, Map<String,Long> usedBytesOnTiers, Map<String,List<Long>> currentBlocksOnTiers) throws alluxio.thrift.AlluxioTException, org.apache.thrift.TException;
}
public interface AsyncIface extends alluxio.thrift.AlluxioService .AsyncIface {
public void commitBlock(long workerId, long usedBytesOnTier, String tierAlias, long blockId, long length, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void getWorkerId(alluxio.thrift.WorkerNetAddress workerNetAddress, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void heartbeat(long workerId, Map<String,Long> usedBytesOnTiers, List<Long> removedBlockIds, Map<String,List<Long>> addedBlocksOnTiers, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void registerWorker(long workerId, List<String> storageTiers, Map<String,Long> totalBytesOnTiers, Map<String,Long> usedBytesOnTiers, Map<String,List<Long>> currentBlocksOnTiers, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
}
public static class Client extends alluxio.thrift.AlluxioService.Client implements Iface {
public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
public Factory() {}
public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
return new Client(prot);
}
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);
}
public void commitBlock(long workerId, long usedBytesOnTier, String tierAlias, long blockId, long length) throws org.apache.thrift.TException
{
send_commitBlock(workerId, usedBytesOnTier, tierAlias, blockId, length);
recv_commitBlock();
}
public void send_commitBlock(long workerId, long usedBytesOnTier, String tierAlias, long blockId, long length) throws org.apache.thrift.TException
{
commitBlock_args args = new commitBlock_args();
args.setWorkerId(workerId);
args.setUsedBytesOnTier(usedBytesOnTier);
args.setTierAlias(tierAlias);
args.setBlockId(blockId);
args.setLength(length);
sendBase("commitBlock", args);
}
public void recv_commitBlock() throws org.apache.thrift.TException
{
commitBlock_result result = new commitBlock_result();
receiveBase(result, "commitBlock");
return;
}
public long getWorkerId(alluxio.thrift.WorkerNetAddress workerNetAddress) throws org.apache.thrift.TException
{
send_getWorkerId(workerNetAddress);
return recv_getWorkerId();
}
public void send_getWorkerId(alluxio.thrift.WorkerNetAddress workerNetAddress) throws org.apache.thrift.TException
{
getWorkerId_args args = new getWorkerId_args();
args.setWorkerNetAddress(workerNetAddress);
sendBase("getWorkerId", args);
}
public long recv_getWorkerId() throws org.apache.thrift.TException
{
getWorkerId_result result = new getWorkerId_result();
receiveBase(result, "getWorkerId");
if (result.isSetSuccess()) {
return result.success;
}
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getWorkerId failed: unknown result");
}
public alluxio.thrift.Command heartbeat(long workerId, Map<String,Long> usedBytesOnTiers, List<Long> removedBlockIds, Map<String,List<Long>> addedBlocksOnTiers) throws org.apache.thrift.TException
{
send_heartbeat(workerId, usedBytesOnTiers, removedBlockIds, addedBlocksOnTiers);
return recv_heartbeat();
}
public void send_heartbeat(long workerId, Map<String,Long> usedBytesOnTiers, List<Long> removedBlockIds, Map<String,List<Long>> addedBlocksOnTiers) throws org.apache.thrift.TException
{
heartbeat_args args = new heartbeat_args();
args.setWorkerId(workerId);
args.setUsedBytesOnTiers(usedBytesOnTiers);
args.setRemovedBlockIds(removedBlockIds);
args.setAddedBlocksOnTiers(addedBlocksOnTiers);
sendBase("heartbeat", args);
}
public alluxio.thrift.Command recv_heartbeat() throws org.apache.thrift.TException
{
heartbeat_result result = new heartbeat_result();
receiveBase(result, "heartbeat");
if (result.isSetSuccess()) {
return result.success;
}
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "heartbeat failed: unknown result");
}
public void registerWorker(long workerId, List<String> storageTiers, Map<String,Long> totalBytesOnTiers, Map<String,Long> usedBytesOnTiers, Map<String,List<Long>> currentBlocksOnTiers) throws alluxio.thrift.AlluxioTException, org.apache.thrift.TException
{
send_registerWorker(workerId, storageTiers, totalBytesOnTiers, usedBytesOnTiers, currentBlocksOnTiers);
recv_registerWorker();
}
public void send_registerWorker(long workerId, List<String> storageTiers, Map<String,Long> totalBytesOnTiers, Map<String,Long> usedBytesOnTiers, Map<String,List<Long>> currentBlocksOnTiers) throws org.apache.thrift.TException
{
registerWorker_args args = new registerWorker_args();
args.setWorkerId(workerId);
args.setStorageTiers(storageTiers);
args.setTotalBytesOnTiers(totalBytesOnTiers);
args.setUsedBytesOnTiers(usedBytesOnTiers);
args.setCurrentBlocksOnTiers(currentBlocksOnTiers);
sendBase("registerWorker", args);
}
public void recv_registerWorker() throws alluxio.thrift.AlluxioTException, org.apache.thrift.TException
{
registerWorker_result result = new registerWorker_result();
receiveBase(result, "registerWorker");
if (result.e != null) {
throw result.e;
}
return;
}
}
public static class AsyncClient extends alluxio.thrift.AlluxioService.AsyncClient 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;
}
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);
}
public void commitBlock(long workerId, long usedBytesOnTier, String tierAlias, long blockId, long length, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
commitBlock_call method_call = new commitBlock_call(workerId, usedBytesOnTier, tierAlias, blockId, length, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class commitBlock_call extends org.apache.thrift.async.TAsyncMethodCall {
private long workerId;
private long usedBytesOnTier;
private String tierAlias;
private long blockId;
private long length;
public commitBlock_call(long workerId, long usedBytesOnTier, String tierAlias, long blockId, long length, org.apache.thrift.async.AsyncMethodCallback 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.workerId = workerId;
this.usedBytesOnTier = usedBytesOnTier;
this.tierAlias = tierAlias;
this.blockId = blockId;
this.length = length;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("commitBlock", org.apache.thrift.protocol.TMessageType.CALL, 0));
commitBlock_args args = new commitBlock_args();
args.setWorkerId(workerId);
args.setUsedBytesOnTier(usedBytesOnTier);
args.setTierAlias(tierAlias);
args.setBlockId(blockId);
args.setLength(length);
args.write(prot);
prot.writeMessageEnd();
}
public void getResult() throws org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new 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_commitBlock();
}
}
public void getWorkerId(alluxio.thrift.WorkerNetAddress workerNetAddress, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
getWorkerId_call method_call = new getWorkerId_call(workerNetAddress, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class getWorkerId_call extends org.apache.thrift.async.TAsyncMethodCall {
private alluxio.thrift.WorkerNetAddress workerNetAddress;
public getWorkerId_call(alluxio.thrift.WorkerNetAddress workerNetAddress, org.apache.thrift.async.AsyncMethodCallback 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.workerNetAddress = workerNetAddress;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getWorkerId", org.apache.thrift.protocol.TMessageType.CALL, 0));
getWorkerId_args args = new getWorkerId_args();
args.setWorkerNetAddress(workerNetAddress);
args.write(prot);
prot.writeMessageEnd();
}
public long getResult() throws org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new 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_getWorkerId();
}
}
public void heartbeat(long workerId, Map<String,Long> usedBytesOnTiers, List<Long> removedBlockIds, Map<String,List<Long>> addedBlocksOnTiers, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
heartbeat_call method_call = new heartbeat_call(workerId, usedBytesOnTiers, removedBlockIds, addedBlocksOnTiers, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class heartbeat_call extends org.apache.thrift.async.TAsyncMethodCall {
private long workerId;
private Map<String,Long> usedBytesOnTiers;
private List<Long> removedBlockIds;
private Map<String,List<Long>> addedBlocksOnTiers;
public heartbeat_call(long workerId, Map<String,Long> usedBytesOnTiers, List<Long> removedBlockIds, Map<String,List<Long>> addedBlocksOnTiers, org.apache.thrift.async.AsyncMethodCallback 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.workerId = workerId;
this.usedBytesOnTiers = usedBytesOnTiers;
this.removedBlockIds = removedBlockIds;
this.addedBlocksOnTiers = addedBlocksOnTiers;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("heartbeat", org.apache.thrift.protocol.TMessageType.CALL, 0));
heartbeat_args args = new heartbeat_args();
args.setWorkerId(workerId);
args.setUsedBytesOnTiers(usedBytesOnTiers);
args.setRemovedBlockIds(removedBlockIds);
args.setAddedBlocksOnTiers(addedBlocksOnTiers);
args.write(prot);
prot.writeMessageEnd();
}
public alluxio.thrift.Command getResult() throws org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new 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_heartbeat();
}
}
public void registerWorker(long workerId, List<String> storageTiers, Map<String,Long> totalBytesOnTiers, Map<String,Long> usedBytesOnTiers, Map<String,List<Long>> currentBlocksOnTiers, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
registerWorker_call method_call = new registerWorker_call(workerId, storageTiers, totalBytesOnTiers, usedBytesOnTiers, currentBlocksOnTiers, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class registerWorker_call extends org.apache.thrift.async.TAsyncMethodCall {
private long workerId;
private List<String> storageTiers;
private Map<String,Long> totalBytesOnTiers;
private Map<String,Long> usedBytesOnTiers;
private Map<String,List<Long>> currentBlocksOnTiers;
public registerWorker_call(long workerId, List<String> storageTiers, Map<String,Long> totalBytesOnTiers, Map<String,Long> usedBytesOnTiers, Map<String,List<Long>> currentBlocksOnTiers, org.apache.thrift.async.AsyncMethodCallback 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.workerId = workerId;
this.storageTiers = storageTiers;
this.totalBytesOnTiers = totalBytesOnTiers;
this.usedBytesOnTiers = usedBytesOnTiers;
this.currentBlocksOnTiers = currentBlocksOnTiers;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("registerWorker", org.apache.thrift.protocol.TMessageType.CALL, 0));
registerWorker_args args = new registerWorker_args();
args.setWorkerId(workerId);
args.setStorageTiers(storageTiers);
args.setTotalBytesOnTiers(totalBytesOnTiers);
args.setUsedBytesOnTiers(usedBytesOnTiers);
args.setCurrentBlocksOnTiers(currentBlocksOnTiers);
args.write(prot);
prot.writeMessageEnd();
}
public void getResult() throws alluxio.thrift.AlluxioTException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new 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_registerWorker();
}
}
}
public static class Processor<I extends Iface> extends alluxio.thrift.AlluxioService.Processor<I> implements org.apache.thrift.TProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
public Processor(I iface) {
super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
}
protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
super(iface, getProcessMap(processMap));
}
private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
processMap.put("commitBlock", new commitBlock());
processMap.put("getWorkerId", new getWorkerId());
processMap.put("heartbeat", new heartbeat());
processMap.put("registerWorker", new registerWorker());
return processMap;
}
public static class commitBlock<I extends Iface> extends org.apache.thrift.ProcessFunction<I, commitBlock_args> {
public commitBlock() {
super("commitBlock");
}
public commitBlock_args getEmptyArgsInstance() {
return new commitBlock_args();
}
protected boolean isOneway() {
return false;
}
public commitBlock_result getResult(I iface, commitBlock_args args) throws org.apache.thrift.TException {
commitBlock_result result = new commitBlock_result();
iface.commitBlock(args.workerId, args.usedBytesOnTier, args.tierAlias, args.blockId, args.length);
return result;
}
}
public static class getWorkerId<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getWorkerId_args> {
public getWorkerId() {
super("getWorkerId");
}
public getWorkerId_args getEmptyArgsInstance() {
return new getWorkerId_args();
}
protected boolean isOneway() {
return false;
}
public getWorkerId_result getResult(I iface, getWorkerId_args args) throws org.apache.thrift.TException {
getWorkerId_result result = new getWorkerId_result();
result.success = iface.getWorkerId(args.workerNetAddress);
result.setSuccessIsSet(true);
return result;
}
}
public static class heartbeat<I extends Iface> extends org.apache.thrift.ProcessFunction<I, heartbeat_args> {
public heartbeat() {
super("heartbeat");
}
public heartbeat_args getEmptyArgsInstance() {
return new heartbeat_args();
}
protected boolean isOneway() {
return false;
}
public heartbeat_result getResult(I iface, heartbeat_args args) throws org.apache.thrift.TException {
heartbeat_result result = new heartbeat_result();
result.success = iface.heartbeat(args.workerId, args.usedBytesOnTiers, args.removedBlockIds, args.addedBlocksOnTiers);
return result;
}
}
public static class registerWorker<I extends Iface> extends org.apache.thrift.ProcessFunction<I, registerWorker_args> {
public registerWorker() {
super("registerWorker");
}
public registerWorker_args getEmptyArgsInstance() {
return new registerWorker_args();
}
protected boolean isOneway() {
return false;
}
public registerWorker_result getResult(I iface, registerWorker_args args) throws org.apache.thrift.TException {
registerWorker_result result = new registerWorker_result();
try {
iface.registerWorker(args.workerId, args.storageTiers, args.totalBytesOnTiers, args.usedBytesOnTiers, args.currentBlocksOnTiers);
} catch (alluxio.thrift.AlluxioTException e) {
result.e = e;
}
return result;
}
}
}
public static class AsyncProcessor<I extends AsyncIface> extends alluxio.thrift.AlluxioService.AsyncProcessor<I> {
private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
public AsyncProcessor(I iface) {
super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
}
protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
super(iface, getProcessMap(processMap));
}
private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
processMap.put("commitBlock", new commitBlock());
processMap.put("getWorkerId", new getWorkerId());
processMap.put("heartbeat", new heartbeat());
processMap.put("registerWorker", new registerWorker());
return processMap;
}
public static class commitBlock<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, commitBlock_args, Void> {
public commitBlock() {
super("commitBlock");
}
public commitBlock_args getEmptyArgsInstance() {
return new commitBlock_args();
}
public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
return new AsyncMethodCallback<Void>() {
public void onComplete(Void o) {
commitBlock_result result = new commitBlock_result();
try {
fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
return;
} catch (Exception e) {
LOGGER.error("Exception writing to internal frame buffer", e);
}
fb.close();
}
public void onError(Exception e) {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
commitBlock_result result = new commitBlock_result();
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
return;
} catch (Exception ex) {
LOGGER.error("Exception writing to internal frame buffer", ex);
}
fb.close();
}
};
}
protected boolean isOneway() {
return false;
}
public void start(I iface, commitBlock_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
iface.commitBlock(args.workerId, args.usedBytesOnTier, args.tierAlias, args.blockId, args.length,resultHandler);
}
}
public static class getWorkerId<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getWorkerId_args, Long> {
public getWorkerId() {
super("getWorkerId");
}
public getWorkerId_args getEmptyArgsInstance() {
return new getWorkerId_args();
}
public AsyncMethodCallback<Long> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
return new AsyncMethodCallback<Long>() {
public void onComplete(Long o) {
getWorkerId_result result = new getWorkerId_result();
result.success = o;
result.setSuccessIsSet(true);
try {
fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
return;
} catch (Exception e) {
LOGGER.error("Exception writing to internal frame buffer", e);
}
fb.close();
}
public void onError(Exception e) {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
getWorkerId_result result = new getWorkerId_result();
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
return;
} catch (Exception ex) {
LOGGER.error("Exception writing to internal frame buffer", ex);
}
fb.close();
}
};
}
protected boolean isOneway() {
return false;
}
public void start(I iface, getWorkerId_args args, org.apache.thrift.async.AsyncMethodCallback<Long> resultHandler) throws TException {
iface.getWorkerId(args.workerNetAddress,resultHandler);
}
}
public static class heartbeat<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, heartbeat_args, alluxio.thrift.Command> {
public heartbeat() {
super("heartbeat");
}
public heartbeat_args getEmptyArgsInstance() {
return new heartbeat_args();
}
public AsyncMethodCallback<alluxio.thrift.Command> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
return new AsyncMethodCallback<alluxio.thrift.Command>() {
public void onComplete(alluxio.thrift.Command o) {
heartbeat_result result = new heartbeat_result();
result.success = o;
try {
fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
return;
} catch (Exception e) {
LOGGER.error("Exception writing to internal frame buffer", e);
}
fb.close();
}
public void onError(Exception e) {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
heartbeat_result result = new heartbeat_result();
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
return;
} catch (Exception ex) {
LOGGER.error("Exception writing to internal frame buffer", ex);
}
fb.close();
}
};
}
protected boolean isOneway() {
return false;
}
public void start(I iface, heartbeat_args args, org.apache.thrift.async.AsyncMethodCallback<alluxio.thrift.Command> resultHandler) throws TException {
iface.heartbeat(args.workerId, args.usedBytesOnTiers, args.removedBlockIds, args.addedBlocksOnTiers,resultHandler);
}
}
public static class registerWorker<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, registerWorker_args, Void> {
public registerWorker() {
super("registerWorker");
}
public registerWorker_args getEmptyArgsInstance() {
return new registerWorker_args();
}
public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
return new AsyncMethodCallback<Void>() {
public void onComplete(Void o) {
registerWorker_result result = new registerWorker_result();
try {
fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
return;
} catch (Exception e) {
LOGGER.error("Exception writing to internal frame buffer", e);
}
fb.close();
}
public void onError(Exception e) {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
registerWorker_result result = new registerWorker_result();
if (e instanceof alluxio.thrift.AlluxioTException) {
result.e = (alluxio.thrift.AlluxioTException) e;
result.setEIsSet(true);
msg = result;
}
else
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
return;
} catch (Exception ex) {
LOGGER.error("Exception writing to internal frame buffer", ex);
}
fb.close();
}
};
}
protected boolean isOneway() {
return false;
}
public void start(I iface, registerWorker_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
iface.registerWorker(args.workerId, args.storageTiers, args.totalBytesOnTiers, args.usedBytesOnTiers, args.currentBlocksOnTiers,resultHandler);
}
}
}
public static class commitBlock_args implements org.apache.thrift.TBase<commitBlock_args, commitBlock_args._Fields>, java.io.Serializable, Cloneable, Comparable<commitBlock_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("commitBlock_args");
private static final org.apache.thrift.protocol.TField WORKER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("workerId", org.apache.thrift.protocol.TType.I64, (short)1);
private static final org.apache.thrift.protocol.TField USED_BYTES_ON_TIER_FIELD_DESC = new org.apache.thrift.protocol.TField("usedBytesOnTier", org.apache.thrift.protocol.TType.I64, (short)2);
private static final org.apache.thrift.protocol.TField TIER_ALIAS_FIELD_DESC = new org.apache.thrift.protocol.TField("tierAlias", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField BLOCK_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("blockId", org.apache.thrift.protocol.TType.I64, (short)4);
private static final org.apache.thrift.protocol.TField LENGTH_FIELD_DESC = new org.apache.thrift.protocol.TField("length", org.apache.thrift.protocol.TType.I64, (short)5);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new commitBlock_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new commitBlock_argsTupleSchemeFactory());
}
private long workerId; // required
private long usedBytesOnTier; // required
private String tierAlias; // required
private long blockId; // required
private long length; // 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 {
/**
* the id of the worker
*/
WORKER_ID((short)1, "workerId"),
/**
* the space used in bytes on the target tier
*/
USED_BYTES_ON_TIER((short)2, "usedBytesOnTier"),
/**
* the alias of the target tier
*/
TIER_ALIAS((short)3, "tierAlias"),
/**
* the id of the block being committed
*/
BLOCK_ID((short)4, "blockId"),
/**
* the length of the block being committed
*/
LENGTH((short)5, "length");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // WORKER_ID
return WORKER_ID;
case 2: // USED_BYTES_ON_TIER
return USED_BYTES_ON_TIER;
case 3: // TIER_ALIAS
return TIER_ALIAS;
case 4: // BLOCK_ID
return BLOCK_ID;
case 5: // LENGTH
return LENGTH;
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 IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __WORKERID_ISSET_ID = 0;
private static final int __USEDBYTESONTIER_ISSET_ID = 1;
private static final int __BLOCKID_ISSET_ID = 2;
private static final int __LENGTH_ISSET_ID = 3;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.WORKER_ID, new org.apache.thrift.meta_data.FieldMetaData("workerId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.USED_BYTES_ON_TIER, new org.apache.thrift.meta_data.FieldMetaData("usedBytesOnTier", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.TIER_ALIAS, new org.apache.thrift.meta_data.FieldMetaData("tierAlias", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.BLOCK_ID, new org.apache.thrift.meta_data.FieldMetaData("blockId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.LENGTH, new org.apache.thrift.meta_data.FieldMetaData("length", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(commitBlock_args.class, metaDataMap);
}
public commitBlock_args() {
}
public commitBlock_args(
long workerId,
long usedBytesOnTier,
String tierAlias,
long blockId,
long length)
{
this();
this.workerId = workerId;
setWorkerIdIsSet(true);
this.usedBytesOnTier = usedBytesOnTier;
setUsedBytesOnTierIsSet(true);
this.tierAlias = tierAlias;
this.blockId = blockId;
setBlockIdIsSet(true);
this.length = length;
setLengthIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public commitBlock_args(commitBlock_args other) {
__isset_bitfield = other.__isset_bitfield;
this.workerId = other.workerId;
this.usedBytesOnTier = other.usedBytesOnTier;
if (other.isSetTierAlias()) {
this.tierAlias = other.tierAlias;
}
this.blockId = other.blockId;
this.length = other.length;
}
public commitBlock_args deepCopy() {
return new commitBlock_args(this);
}
@Override
public void clear() {
setWorkerIdIsSet(false);
this.workerId = 0;
setUsedBytesOnTierIsSet(false);
this.usedBytesOnTier = 0;
this.tierAlias = null;
setBlockIdIsSet(false);
this.blockId = 0;
setLengthIsSet(false);
this.length = 0;
}
/**
* the id of the worker
*/
public long getWorkerId() {
return this.workerId;
}
/**
* the id of the worker
*/
public commitBlock_args setWorkerId(long workerId) {
this.workerId = workerId;
setWorkerIdIsSet(true);
return this;
}
public void unsetWorkerId() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WORKERID_ISSET_ID);
}
/** Returns true if field workerId is set (has been assigned a value) and false otherwise */
public boolean isSetWorkerId() {
return EncodingUtils.testBit(__isset_bitfield, __WORKERID_ISSET_ID);
}
public void setWorkerIdIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WORKERID_ISSET_ID, value);
}
/**
* the space used in bytes on the target tier
*/
public long getUsedBytesOnTier() {
return this.usedBytesOnTier;
}
/**
* the space used in bytes on the target tier
*/
public commitBlock_args setUsedBytesOnTier(long usedBytesOnTier) {
this.usedBytesOnTier = usedBytesOnTier;
setUsedBytesOnTierIsSet(true);
return this;
}
public void unsetUsedBytesOnTier() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __USEDBYTESONTIER_ISSET_ID);
}
/** Returns true if field usedBytesOnTier is set (has been assigned a value) and false otherwise */
public boolean isSetUsedBytesOnTier() {
return EncodingUtils.testBit(__isset_bitfield, __USEDBYTESONTIER_ISSET_ID);
}
public void setUsedBytesOnTierIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __USEDBYTESONTIER_ISSET_ID, value);
}
/**
* the alias of the target tier
*/
public String getTierAlias() {
return this.tierAlias;
}
/**
* the alias of the target tier
*/
public commitBlock_args setTierAlias(String tierAlias) {
this.tierAlias = tierAlias;
return this;
}
public void unsetTierAlias() {
this.tierAlias = null;