use of alluxio.client.block.AlluxioBlockStore in project alluxio by Alluxio.
the class GetUsedBytesCommand method run.
@Override
public void run(CommandLine cl) throws IOException {
AlluxioBlockStore blockStore = AlluxioBlockStore.create();
long usedBytes = blockStore.getUsedBytes();
System.out.println("Used Bytes: " + usedBytes);
}
use of alluxio.client.block.AlluxioBlockStore in project alluxio by Alluxio.
the class LocationCommand method runCommand.
@Override
protected void runCommand(AlluxioURI path, CommandLine cl) throws AlluxioException, IOException {
URIStatus status = mFileSystem.getStatus(path);
System.out.println(path + " with file id " + status.getFileId() + " is on nodes: ");
AlluxioBlockStore blockStore = AlluxioBlockStore.create();
for (long blockId : status.getBlockIds()) {
for (BlockLocation location : blockStore.getInfo(blockId).getLocations()) {
System.out.println(location.getWorkerAddress().getHost());
}
}
}
use of alluxio.client.block.AlluxioBlockStore in project alluxio by Alluxio.
the class RemoteBlockInStreamIntegrationTest method readTest4.
/**
* Tests {@link RemoteBlockInStream#read()}. Read from remote data server.
*/
@Test
public void readTest4() throws Exception {
String uniqPath = PathUtils.uniqPath();
for (int k = MIN_LEN + DELTA; k <= MAX_LEN; k += DELTA) {
AlluxioURI uri = new AlluxioURI(uniqPath + "/file_" + k);
FileSystemTestUtils.createByteFile(mFileSystem, uri, mWriteAlluxio, k);
long blockId = mFileSystem.getStatus(uri).getBlockIds().get(0);
AlluxioBlockStore blockStore = AlluxioBlockStore.create();
BlockInfo info = blockStore.getInfo(blockId);
WorkerNetAddress workerAddr = info.getLocations().get(0).getWorkerAddress();
RemoteBlockInStream is = RemoteBlockInStream.create(info.getBlockId(), info.getLength(), workerAddr, FileSystemContext.INSTANCE, InStreamOptions.defaults());
byte[] ret = new byte[k];
int value = is.read();
int cnt = 0;
while (value != -1) {
Assert.assertTrue(value >= 0);
Assert.assertTrue(value < 256);
ret[cnt++] = (byte) value;
value = is.read();
}
Assert.assertEquals(cnt, k);
Assert.assertTrue(BufferUtils.equalIncreasingByteArray(k, ret));
is.close();
Assert.assertTrue(mFileSystem.getStatus(uri).getInMemoryPercentage() == 100);
}
}
use of alluxio.client.block.AlluxioBlockStore in project alluxio by Alluxio.
the class GetCapacityBytesCommand method run.
@Override
public void run(CommandLine cl) throws IOException {
AlluxioBlockStore alluxioBlockStore = AlluxioBlockStore.create();
long capacityBytes = alluxioBlockStore.getCapacityBytes();
System.out.println("Capacity Bytes: " + capacityBytes);
}
use of alluxio.client.block.AlluxioBlockStore in project alluxio by Alluxio.
the class StatCommand method runCommand.
@Override
protected void runCommand(AlluxioURI path, CommandLine cl) throws AlluxioException, IOException {
URIStatus status = mFileSystem.getStatus(path);
if (status.isFolder()) {
System.out.println(path + " is a directory path.");
System.out.println(status);
} else {
System.out.println(path + " is a file path.");
System.out.println(status);
System.out.println("Containing the following blocks: ");
AlluxioBlockStore blockStore = AlluxioBlockStore.create();
for (long blockId : status.getBlockIds()) {
System.out.println(blockStore.getInfo(blockId));
}
}
}
Aggregations