@Override public synchronized List<SyncPointInfo> getSyncPathList() throws AlluxioStatusException { return retryRPC(() -> mClient.getSyncPathList(GetSyncPathListPRequest.getDefaultInstance()) .getSyncPathsList().stream().map(x -> alluxio.wire.SyncPointInfo.fromProto(x)) .collect(Collectors.toList()), "GetSyncPathList"); }
@Override public Map<String, alluxio.wire.MountPointInfo> getMountTable() throws AlluxioStatusException { return retryRPC(() -> { Map<String, alluxio.wire.MountPointInfo> mountTableWire = new HashMap<>(); for (Map.Entry<String, alluxio.grpc.MountPointInfo> entry : mClient .getMountTable(GetMountTablePRequest.newBuilder().build()).getMountPointsMap() .entrySet()) { mountTableWire.put(entry.getKey(), GrpcUtils.fromProto(entry.getValue())); } return mountTableWire; }, "GetMountTable"); }
@Override public void setAcl(AlluxioURI path, SetAclAction action, List<AclEntry> entries, SetAclPOptions options) throws AlluxioStatusException { retryRPC(() -> mClient.setAcl( SetAclPRequest.newBuilder().setPath(path.getPath()).setAction(action) .addAllEntries(entries.stream().map(GrpcUtils::toProto).collect(Collectors.toList())) .setOptions(options).build()), "SetAcl"); }
@Override public List<AlluxioURI> checkConsistency(final AlluxioURI path, final CheckConsistencyPOptions options) throws AlluxioStatusException { return retryRPC(() -> { List<String> inconsistentPaths = mClient.checkConsistency(CheckConsistencyPRequest .newBuilder().setPath(path.getPath()).setOptions(options).build()) .getInconsistentPathsList(); List<AlluxioURI> inconsistentUris = new ArrayList<>(inconsistentPaths.size()); for (String inconsistentPath : inconsistentPaths) { inconsistentUris.add(new AlluxioURI(inconsistentPath)); } return inconsistentUris; }, "CheckConsistency"); }
@Override public synchronized void stopSync(final AlluxioURI path) throws AlluxioStatusException { retryRPC(() -> mClient.stopSync(StopSyncPRequest.newBuilder().setPath(path.getPath()).build()), "StopSync"); }
@Override public void scheduleAsyncPersist(final AlluxioURI path) throws AlluxioStatusException { retryRPC( () -> mClient.scheduleAsyncPersistence( ScheduleAsyncPersistencePRequest.newBuilder().setPath(path.getPath()).build()), "ScheduleAsyncPersist"); }
@Override public synchronized void startSync(final AlluxioURI path) throws AlluxioStatusException { retryRPC( () -> mClient.startSync(StartSyncPRequest.newBuilder().setPath(path.getPath()).build()), "StartSync"); }
@Override public List<URIStatus> listStatus(final AlluxioURI path, final ListStatusPOptions options) throws AlluxioStatusException { return retryRPC(() -> { List<URIStatus> result = new ArrayList<>(); for (alluxio.grpc.FileInfo fileInfo : mClient.listStatus(ListStatusPRequest.newBuilder() .setPath(path.getPath()).setOptions(options).build()) .getFileInfosList()) { result.add(new URIStatus(GrpcUtils.fromProto(fileInfo))); } return result; }, "ListStatus"); }
@Override public void createFile(final AlluxioURI path, final CreateFilePOptions options) throws AlluxioStatusException { retryRPC(() -> mClient.createFile(CreateFilePRequest.newBuilder().setPath(path.getPath()) .setOptions(options).build()), "CreateFile"); }
@Override public void setAttribute(final AlluxioURI path, final SetAttributePOptions options) throws AlluxioStatusException { retryRPC(() -> mClient.setAttribute(SetAttributePRequest.newBuilder() .setPath(path.getPath()).setOptions(options).build()), "SetAttribute"); }
@Override public void free(final AlluxioURI path, final FreePOptions options) throws AlluxioStatusException { retryRPC(() -> mClient.free(FreePRequest.newBuilder().setPath(path.getPath()) .setOptions(options).build()), "Free"); }
@Override public void createDirectory(final AlluxioURI path, final CreateDirectoryPOptions options) throws AlluxioStatusException { retryRPC( () -> mClient.createDirectory(CreateDirectoryPRequest.newBuilder() .setPath(path.getPath()).setOptions(options).build()), "CreateDirectory"); }
@Override public void completeFile(final AlluxioURI path, final CompleteFilePOptions options) throws AlluxioStatusException { retryRPC(() -> mClient.completeFile(CompleteFilePRequest.newBuilder() .setPath(path.getPath()).setOptions(options).build()), "CompleteFile"); }
@Override public void delete(final AlluxioURI path, final DeletePOptions options) throws AlluxioStatusException { retryRPC(() -> mClient.remove(DeletePRequest.newBuilder().setPath(path.getPath()) .setOptions(options).build()), "Delete"); }
@Override public void updateUfsMode(final AlluxioURI ufsUri, final UpdateUfsModePOptions options) throws AlluxioStatusException { retryRPC( () -> mClient.updateUfsMode(UpdateUfsModePRequest.newBuilder() .setUfsPath(ufsUri.getRootPath()).setOptions(options).build()), "UpdateUfsMode"); } }
@Override public void mount(final AlluxioURI alluxioPath, final AlluxioURI ufsPath, final MountPOptions options) throws AlluxioStatusException { retryRPC( () -> mClient.mount(MountPRequest.newBuilder().setAlluxioPath(alluxioPath.toString()) .setUfsPath(ufsPath.toString()).setOptions(options).build()), "Mount"); }
@Override public void rename(final AlluxioURI src, final AlluxioURI dst, final RenamePOptions options) throws AlluxioStatusException { retryRPC(() -> mClient.rename(RenamePRequest.newBuilder().setPath(src.getPath()) .setDstPath(dst.getPath()).setOptions(options).build()), "Rename"); }
@Override public void unmount(final AlluxioURI alluxioPath) throws AlluxioStatusException { retryRPC(() -> mClient .unmount(UnmountPRequest.newBuilder().setAlluxioPath(alluxioPath.toString()) .setOptions(UnmountPOptions.newBuilder().build()).build()), "Unmount"); }
@Override public URIStatus getStatus(final AlluxioURI path, final GetStatusPOptions options) throws AlluxioStatusException { return retryRPC(() -> new URIStatus(GrpcUtils .fromProto(mClient.getStatus(GetStatusPRequest.newBuilder().setPath(path.getPath()) .setOptions(options).build()).getFileInfo())), "GetStatus"); }
@Override public long getNewBlockIdForFile(final AlluxioURI path) throws AlluxioStatusException { return retryRPC( () -> mClient .getNewBlockIdForFile(GetNewBlockIdForFilePRequest.newBuilder().setPath(path.getPath()) .setOptions(GetNewBlockIdForFilePOptions.newBuilder().build()).build()) .getId(), "GetNewBlockIdForFile"); }