/
BlockMasterClient.java
88 lines (75 loc) · 2.49 KB
/
BlockMasterClient.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
/*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied, as more fully set forth in the License.
*
* See the NOTICE file distributed with this work for information regarding copyright ownership.
*/
package alluxio.client.block;
import alluxio.Client;
import alluxio.master.MasterInquireClient;
import alluxio.wire.BlockInfo;
import alluxio.wire.WorkerInfo;
import java.io.IOException;
import java.util.List;
import javax.annotation.concurrent.ThreadSafe;
import javax.security.auth.Subject;
/**
* A client to use for interacting with a block master.
*/
@ThreadSafe
public interface BlockMasterClient extends Client {
/**
* Factory for {@link BlockMasterClient}.
*/
class Factory {
private Factory() {} // prevent instantiation
/**
* Factory method for {@link BlockMasterClient}.
*
* @return a new {@link BlockMasterClient} instance
*/
public static BlockMasterClient create() {
return create(null, MasterInquireClient.Factory.create());
}
/**
* Factory method for {@link BlockMasterClient}.
*
* @param subject the parent subject
* @param masterInquireClient a client for determining the master address
* @return a new {@link BlockMasterClient} instance
*/
public static BlockMasterClient create(Subject subject,
MasterInquireClient masterInquireClient) {
return new RetryHandlingBlockMasterClient(subject, masterInquireClient);
}
}
/**
* Gets the info of a list of workers.
*
* @return A list of worker info returned by master
*/
List<WorkerInfo> getWorkerInfoList() throws IOException;
/**
* Returns the {@link BlockInfo} for a block id.
*
* @param blockId the block id to get the BlockInfo for
* @return the {@link BlockInfo}
*/
BlockInfo getBlockInfo(final long blockId) throws IOException;
/**
* Gets the total Alluxio capacity in bytes, on all the tiers of all the workers.
*
* @return total capacity in bytes
*/
long getCapacityBytes() throws IOException;
/**
* Gets the total amount of used space in bytes, on all the tiers of all the workers.
*
* @return amount of used space in bytes
*/
long getUsedBytes() throws IOException;
}