/** * Get the sync point list. * * @return a list of URIs (sync points) */ public List<SyncPointInfo> getSyncPathList() { List<SyncPointInfo> returnList = new ArrayList<>(); for (AlluxioURI uri: mSyncPathList) { SyncPointInfo.SyncStatus status; Future<?> syncStatus = mSyncPathStatus.get(uri); if (syncStatus == null) { status = SyncPointInfo.SyncStatus.NOT_INITIALLY_SYNCED; } else if (syncStatus.isDone()) { status = SyncPointInfo.SyncStatus.INITIALLY_SYNCED; } else { status = SyncPointInfo.SyncStatus.SYNCING; } returnList.add(new SyncPointInfo(uri, status)); } return returnList; }
@Override public int run(CommandLine cl) throws AlluxioException, IOException { List<SyncPointInfo> files = mFileSystem.getSyncPathList(); System.out.println("The following paths are under active sync"); for (SyncPointInfo syncPointInfo : files) { System.out.print(syncPointInfo.getSyncPointUri() + "\t"); switch (syncPointInfo.getSyncStatus()) { case NOT_INITIALLY_SYNCED: System.out.println("Initial Sync Skipped"); break; case INITIALLY_SYNCED: System.out.println("Initial Sync Done"); break; case SYNCING: System.out.println("Initial Sync In Progress"); break; default: System.out.println("Invalid Syncing Status"); } } return 0; }
@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"); }
/** * Generate sync point information from the proto representation. * @param syncPointInfo the proto representation * @return sync point info object */ public static SyncPointInfo fromProto(alluxio.grpc.SyncPointInfo syncPointInfo) { SyncStatus syncStatus; switch (syncPointInfo.getSyncStatus()) { case Not_Initially_Synced: syncStatus = SyncStatus.NOT_INITIALLY_SYNCED; break; case Syncing: syncStatus = SyncStatus.SYNCING; break; case Initially_Synced: syncStatus = SyncStatus.INITIALLY_SYNCED; break; default: syncStatus = SyncStatus.NOT_INITIALLY_SYNCED; } return new SyncPointInfo(new AlluxioURI(syncPointInfo.getSyncPointUri()), syncStatus); } }