/** * Stages a file from nearline storage. * * <p>TODO: Should eventually accept multiple files at once, but the rest of the pool doesn't * support that yet. * * @param file attributes of file to stage * @param callback callback notified when file is staged */ public void stage( String hsmInstance, FileAttributes file, CompletionHandler<Void, PnfsId> callback) { try { NearlineStorage nearlineStorage = hsmSet.getNearlineStorageByName(hsmInstance); checkArgument(nearlineStorage != null, "No such nearline storage: " + hsmInstance); stageRequests.addAll(nearlineStorage, Collections.singleton(file), callback); } catch (RuntimeException e) { callback.failed(e, file.getPnfsId()); } }
/** * Removes a set of files from nearline storage. * * @param hsmInstance instance name of nearline storage * @param files files to remove * @param callback callback notified for every file removed */ public void remove( String hsmInstance, Iterable<URI> files, CompletionHandler<Void, URI> callback) { try { NearlineStorage nearlineStorage = hsmSet.getNearlineStorageByName(hsmInstance); checkArgument(nearlineStorage != null, "No such nearline storage: " + hsmInstance); removeRequests.addAll(nearlineStorage, files, callback); } catch (RuntimeException e) { for (URI location : files) { callback.failed(e, location); } } }
/** * Flushes a set of files to nearline storage. * * @param hsmType type of nearline storage * @param files files to flush * @param callback callback notified for every file flushed */ public void flush( String hsmType, Iterable<PnfsId> files, CompletionHandler<Void, PnfsId> callback) { try { NearlineStorage nearlineStorage = hsmSet.getNearlineStorageByType(hsmType); checkArgument(nearlineStorage != null, "No such nearline storage: " + hsmType); flushRequests.addAll(nearlineStorage, files, callback); } catch (RuntimeException e) { for (PnfsId pnfsId : files) { callback.failed(e, pnfsId); } } }