/** * @return whether the entity referenced by this uri is pinned, mutable */ public boolean isPinned() { return mInfo.isPinned(); }
/** * Tests the {@link FileSystemMaster#setAttribute(AlluxioURI, SetAttributeContext)} method and * that an exception is thrown when trying to set a TTL for a directory. */ @Test public void setAttribute() throws Exception { mFileSystemMaster.createFile(NESTED_FILE_URI, mNestedFileContext); FileInfo fileInfo = mFileSystemMaster.getFileInfo(NESTED_FILE_URI, GET_STATUS_CONTEXT); assertFalse(fileInfo.isPinned()); assertEquals(Constants.NO_TTL, fileInfo.getTtl()); // No State. mFileSystemMaster.setAttribute(NESTED_FILE_URI, SetAttributeContext.defaults()); fileInfo = mFileSystemMaster.getFileInfo(NESTED_FILE_URI, GET_STATUS_CONTEXT); assertFalse(fileInfo.isPinned()); assertEquals(Constants.NO_TTL, fileInfo.getTtl()); // Just set pinned flag. mFileSystemMaster.setAttribute(NESTED_FILE_URI, SetAttributeContext.defaults(SetAttributePOptions.newBuilder().setPinned(true))); fileInfo = mFileSystemMaster.getFileInfo(NESTED_FILE_URI, GET_STATUS_CONTEXT); assertTrue(fileInfo.isPinned()); assertEquals(Constants.NO_TTL, fileInfo.getTtl()); // Both pinned flag and ttl value. mFileSystemMaster.setAttribute(NESTED_FILE_URI, SetAttributeContext.defaults(SetAttributePOptions.newBuilder().setPinned(false).setTtl(1))); fileInfo = mFileSystemMaster.getFileInfo(NESTED_FILE_URI, GET_STATUS_CONTEXT); assertFalse(fileInfo.isPinned()); assertEquals(1, fileInfo.getTtl()); mFileSystemMaster.setAttribute(NESTED_URI, SetAttributeContext.defaults(SetAttributePOptions.newBuilder().setTtl(1))); }
private SetAttributePOptions verifySetState(TestUser user, String path, SetAttributePOptions options) throws Exception { try (Closeable r = new AuthenticatedUserRule(user.getUser(), ServerConfiguration.global()).toResource()) { mFileSystemMaster.setAttribute(new AlluxioURI(path), SetAttributeContext.defaults(options.toBuilder())); FileInfo fileInfo = mFileSystemMaster.getFileInfo(new AlluxioURI(path), GetStatusContext.defaults()); return FileSystemMasterOptions.setAttributesDefaults().toBuilder() .setPinned(fileInfo.isPinned()).setTtl(fileInfo.getTtl()) .setPersisted(fileInfo.isPersisted()).build(); } }
.setBlockSizeBytes(fileInfo.getBlockSizeBytes()) .setCreationTimeMs(fileInfo.getCreationTimeMs()).setCompleted(fileInfo.isCompleted()) .setFolder(fileInfo.isFolder()).setPinned(fileInfo.isPinned()) .setCacheable(fileInfo.isCacheable()).setPersisted(fileInfo.isPersisted()) .addAllBlockIds(fileInfo.getBlockIds())
/** * Tests the {@link MutableInodeDirectory#generateClientFileInfo(String)} method. */ @Test public void generateClientFileInfo() { MutableInodeDirectory inodeDirectory = createInodeDirectory(); String path = "/test/path"; FileInfo info = inodeDirectory.generateClientFileInfo(path); Assert.assertEquals(inodeDirectory.getId(), info.getFileId()); Assert.assertEquals(inodeDirectory.getName(), info.getName()); Assert.assertEquals(path, info.getPath()); Assert.assertEquals("", info.getUfsPath()); Assert.assertEquals(0, info.getLength()); Assert.assertEquals(0, info.getBlockSizeBytes()); Assert.assertEquals(inodeDirectory.getCreationTimeMs(), info.getCreationTimeMs()); Assert.assertTrue(info.isCompleted()); Assert.assertTrue(info.isFolder()); Assert.assertEquals(inodeDirectory.isPinned(), info.isPinned()); Assert.assertFalse(info.isCacheable()); Assert.assertNotNull(info.getBlockIds()); Assert.assertEquals(inodeDirectory.getLastModificationTimeMs(), info.getLastModificationTimeMs()); } }
/** * @return whether the entity referenced by this uri is pinned, mutable */ public boolean isPinned() { return mInfo.isPinned(); }
/** * @return whether the entity referenced by this uri is pinned, mutable */ public boolean isPinned() { return mInfo.isPinned(); }
Assert.assertEquals(uriStatus.isFolder(), fileInfo.isFolder()); Assert.assertEquals(uriStatus.isPersisted(), fileInfo.isPersisted()); Assert.assertEquals(uriStatus.isPinned(), fileInfo.isPinned()); Assert.assertEquals(uriStatus.isMountPoint(), fileInfo.isMountPoint()); Assert.assertEquals(uriStatus.getFileBlockInfos(),