if (!meta.exists(fileInfo.id())) data.delete(fileInfo);
if (!meta.exists(fileInfo.id())) data.delete(fileInfo);
/** {@inheritDoc} */ @Override public void onEvent(GridEvent evt) { assert evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED; GridDiscoveryEvent evt0 = (GridDiscoveryEvent)evt; if (evt0.eventNode() != null) { if (sameGgfs((GridGgfsAttributes[])evt0.eventNode().attribute(ATTR_GGFS))) { Collection<GridUuid> rmv = new HashSet<>(); for (Map.Entry<GridUuid, GridFutureAdapter<Object>> fut : delFuts.entrySet()) { GridUuid id = fut.getKey(); try { if (!meta.exists(id)) { fut.getValue().onDone(); rmv.add(id); } } catch (GridException e) { U.error(log, "Failed to check file existence: " + id, e); } } for (GridUuid id : rmv) delFuts.remove(id); } } } }
/** {@inheritDoc} */ @Override public void onEvent(GridEvent evt) { assert evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED; GridDiscoveryEvent evt0 = (GridDiscoveryEvent)evt; if (evt0.eventNode() != null) { if (sameGgfs((GridGgfsAttributes[])evt0.eventNode().attribute(ATTR_GGFS))) { Collection<GridUuid> rmv = new HashSet<>(); for (Map.Entry<GridUuid, GridFutureAdapter<Object>> fut : delFuts.entrySet()) { GridUuid id = fut.getKey(); try { if (!meta.exists(id)) { fut.getValue().onDone(); rmv.add(id); } } catch (GridException e) { U.error(log, "Failed to check file existence: " + id, e); } } for (GridUuid id : rmv) delFuts.remove(id); } } } }
exists = meta.exists(fileInfo.id());
exists = meta.exists(fileInfo.id());
exists = !deleted && meta.exists(fileInfo.id());
exists = !deleted && meta.exists(fileInfo.id());
/** {@inheritDoc} */ @Override public GridFuture<?> format() throws GridException { GridUuid id = meta.softDelete(null, null, ROOT_ID); if (id == null) return new GridFinishedFuture<Object>(ggfsCtx.kernalContext()); else { GridFutureAdapter<Object> fut = new GridFutureAdapter<>(ggfsCtx.kernalContext()); GridFutureAdapter<Object> oldFut = delFuts.putIfAbsent(id, fut); if (oldFut != null) return oldFut; else { if (!meta.exists(id)) { // Safety in case response message was received before we put future into collection. fut.onDone(); delFuts.remove(id, fut); } return fut; } } }
/** {@inheritDoc} */ @Override public GridFuture<?> format() throws GridException { GridUuid id = meta.softDelete(null, null, ROOT_ID); if (id == null) return new GridFinishedFuture<Object>(ggfsCtx.kernalContext()); else { GridFutureAdapter<Object> fut = new GridFutureAdapter<>(ggfsCtx.kernalContext()); GridFutureAdapter<Object> oldFut = delFuts.putIfAbsent(id, fut); if (oldFut != null) return oldFut; else { if (!meta.exists(id)) { // Safety in case response message was received before we put future into collection. fut.onDone(); delFuts.remove(id, fut); } return fut; } } }
/** {@inheritDoc} */ @Override public GridFuture<?> awaitDeletesAsync() throws GridException { Collection<GridUuid> ids = meta.pendingDeletes(); if (!ids.isEmpty()) { if (log.isDebugEnabled()) log.debug("Constructing delete future for trash entries: " + ids); GridCompoundFuture<Object, Object> resFut = new GridCompoundFuture<>(ggfsCtx.kernalContext()); for (GridUuid id : ids) { GridFutureAdapter<Object> fut = new GridFutureAdapter<>(ggfsCtx.kernalContext()); GridFuture<Object> oldFut = delFuts.putIfAbsent(id, fut); if (oldFut != null) resFut.add(oldFut); else { if (meta.exists(id)) resFut.add(fut); else { fut.onDone(); delFuts.remove(id, fut); } } } resFut.markInitialized(); return resFut; } else return new GridFinishedFuture<>(ggfsCtx.kernalContext()); }
/** {@inheritDoc} */ @Override public GridFuture<?> awaitDeletesAsync() throws GridException { Collection<GridUuid> ids = meta.pendingDeletes(); if (!ids.isEmpty()) { if (log.isDebugEnabled()) log.debug("Constructing delete future for trash entries: " + ids); GridCompoundFuture<Object, Object> resFut = new GridCompoundFuture<>(ggfsCtx.kernalContext()); for (GridUuid id : ids) { GridFutureAdapter<Object> fut = new GridFutureAdapter<>(ggfsCtx.kernalContext()); GridFuture<Object> oldFut = delFuts.putIfAbsent(id, fut); if (oldFut != null) resFut.add(oldFut); else { if (meta.exists(id)) resFut.add(fut); else { fut.onDone(); delFuts.remove(id, fut); } } } resFut.markInitialized(); return resFut; } else return new GridFinishedFuture<>(ggfsCtx.kernalContext()); }