use of alluxio.underfs.UfsStatus in project alluxio by Alluxio.
the class UfsJournalSnapshot method getNextLogSequenceNumberToCheckpoint.
/**
* Gets the first journal log sequence number that is not yet checkpointed.
*
* @return the first journal log sequence number that is not yet checkpointed
*/
static long getNextLogSequenceNumberToCheckpoint(UfsJournal journal) throws IOException {
List<UfsJournalFile> checkpoints = new ArrayList<>();
UfsStatus[] statuses = journal.getUfs().listStatus(journal.getCheckpointDir().toString());
if (statuses != null) {
for (UfsStatus status : statuses) {
UfsJournalFile file = UfsJournalFile.decodeCheckpointFile(journal, status.getName());
if (file != null) {
checkpoints.add(file);
}
}
Collections.sort(checkpoints);
}
if (checkpoints.isEmpty()) {
return 0;
}
return checkpoints.get(checkpoints.size() - 1).getEnd();
}
use of alluxio.underfs.UfsStatus in project alluxio by Alluxio.
the class UfsJournal method isFormatted.
/**
* @return whether the journal has been formatted
*/
public boolean isFormatted() throws IOException {
UfsStatus[] files = mUfs.listStatus(mLocation.toString());
if (files == null) {
return false;
}
// Search for the format file.
String formatFilePrefix = ServerConfiguration.getString(PropertyKey.MASTER_FORMAT_FILE_PREFIX);
for (UfsStatus file : files) {
if (file.getName().startsWith(formatFilePrefix)) {
return true;
}
}
return false;
}
use of alluxio.underfs.UfsStatus in project alluxio by Alluxio.
the class UnderFileSystemCommonOperations method getDirectoryStatusTest.
/**
* Test for getting directory status.
*/
@RelatedS3Operations(operations = { "putObject", "getObjectMetadata" })
public void getDirectoryStatusTest() throws IOException {
String testDir = PathUtils.concatPath(mTopLevelTestDirectory, "testDir");
mUfs.mkdirs(testDir);
UfsStatus status = mUfs.getStatus(testDir);
if (!(status instanceof UfsDirectoryStatus)) {
throw new IOException("Failed to get ufs directory status");
}
}
use of alluxio.underfs.UfsStatus in project alluxio by Alluxio.
the class UnderFileSystemCommonOperations method createThenGetExistingDirectoryStatusTest.
/**
* Test for getting existing directory status.
*/
@RelatedS3Operations(operations = { "putObject", "getObjectMetadata" })
public void createThenGetExistingDirectoryStatusTest() throws IOException {
String testDir = PathUtils.concatPath(mTopLevelTestDirectory, "testDir");
mUfs.mkdirs(testDir);
UfsStatus status = mUfs.getExistingStatus(testDir);
if (!(status instanceof UfsDirectoryStatus)) {
throw new IOException("Failed to get ufs directory status");
}
}
use of alluxio.underfs.UfsStatus in project alluxio by Alluxio.
the class UnderFileSystemCommonOperations method createThenGetExistingStatusTest.
/**
* Test for getting existing status.
*/
@RelatedS3Operations(operations = {})
public void createThenGetExistingStatusTest() throws IOException {
String testFile = PathUtils.concatPath(mTopLevelTestDirectory, "testFile");
createTestBytesFile(testFile);
UfsStatus status = mUfs.getExistingStatus(testFile);
if (!(status instanceof UfsFileStatus)) {
throw new IOException("Failed to get ufs file status");
}
}
Aggregations