/** * @return the time-to-live in milliseconds since the creation time of the entity referenced by * this uri, mutable */ public long getTtl() { return mInfo.getTtl(); }
.setCacheable(fileInfo.isCacheable()).setPersisted(fileInfo.isPersisted()) .addAllBlockIds(fileInfo.getBlockIds()) .setLastModificationTimeMs(fileInfo.getLastModificationTimeMs()).setTtl(fileInfo.getTtl()) .setOwner(fileInfo.getOwner()).setGroup(fileInfo.getGroup()).setMode(fileInfo.getMode()) .setPersistenceState(fileInfo.getPersistenceState()).setMountPoint(fileInfo.isMountPoint())
/** * 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))); }
Assert.assertEquals(uriStatus.getPersistenceState(), fileInfo.getPersistenceState()); Assert.assertEquals(uriStatus.getTtl(), fileInfo.getTtl()); Assert.assertEquals(uriStatus.getTtlAction(), fileInfo.getTtlAction()); Assert.assertEquals(uriStatus.getUfsPath(), fileInfo.getUfsPath());
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(); } }
/** * @return the time-to-live in milliseconds since the creation time of the entity referenced by * this uri, mutable */ public long getTtl() { return mInfo.getTtl(); }
/** * @return the time-to-live in milliseconds since the creation time of the entity referenced by * this uri, mutable */ public long getTtl() { return mInfo.getTtl(); }