@Override public Boolean onSuccess(Map<IgfsPath, IgfsEntryInfo> infos) throws Exception { fs.mkdirs(path, props); assert !infos.isEmpty(); // Now perform synchronization again starting with the last created parent. IgfsPath parentPath = null; for (IgfsPath curPath : infos.keySet()) { if (parentPath == null || curPath.isSubDirectoryOf(parentPath)) parentPath = curPath; } assert parentPath != null; IgfsEntryInfo parentPathInfo = infos.get(parentPath); synchronize(fs, parentPath, parentPathInfo, path, true, null); if (evts.isRecordable(EventType.EVT_IGFS_DIR_CREATED)) { IgfsPath evtPath = path; while (!parentPath.equals(evtPath)) { pendingEvts.addFirst(new IgfsEvent(evtPath, locNode, EventType.EVT_IGFS_DIR_CREATED)); evtPath = evtPath.parent(); assert evtPath != null; // If this fails, then ROOT does not exist. } } return true; }
/** * Sends a series of event. * * @param kernalCtx Kernal context. * @param path The path of the created file. * @param newPath New path. * @param type The type of event to send. */ public static void sendEvents(GridKernalContext kernalCtx, IgfsPath path, IgfsPath newPath, int type) { assert kernalCtx != null; assert path != null; GridEventStorageManager evts = kernalCtx.event(); ClusterNode locNode = kernalCtx.discovery().localNode(); if (evts.isRecordable(type)) { if (newPath == null) evts.record(new IgfsEvent(path, locNode, type)); else evts.record(new IgfsEvent(path, newPath, locNode, type)); } }
evts.record(new IgfsEvent(path, igfsCtx.localNode(), EVT_IGFS_FILE_CLOSED_READ, bytes()));
/** * Updates IGFS metrics when the stream is closed. */ protected void updateMetricsOnClose() { IgfsLocalMetrics metrics = igfsCtx.metrics(); metrics.addWrittenBytesTime(bytes, time); metrics.decrementFilesOpenedForWrite(); GridEventStorageManager evts = igfsCtx.kernalContext().event(); if (evts.isRecordable(EVT_IGFS_FILE_CLOSED_WRITE)) evts.record(new IgfsEvent(path, igfsCtx.localNode(), EVT_IGFS_FILE_CLOSED_WRITE, bytes)); }
evts.record(new IgfsEvent(path, igfsCtx.localNode(), EVT_IGFS_META_UPDATED, props));
pendingEvts.add(new IgfsEvent(path, locNode, EventType.EVT_IGFS_FILE_OPENED_WRITE));
@Override public Boolean onSuccess(Map<IgfsPath, IgfsEntryInfo> infos) throws Exception { fs.mkdirs(path, props); assert !infos.isEmpty(); // Now perform synchronization again starting with the last created parent. IgfsPath parentPath = null; for (IgfsPath curPath : infos.keySet()) { if (parentPath == null || curPath.isSubDirectoryOf(parentPath)) parentPath = curPath; } assert parentPath != null; IgfsEntryInfo parentPathInfo = infos.get(parentPath); synchronize(fs, parentPath, parentPathInfo, path, true, null); if (evts.isRecordable(EventType.EVT_IGFS_DIR_CREATED)) { IgfsPath evtPath = path; while (!parentPath.equals(evtPath)) { pendingEvts.addFirst(new IgfsEvent(evtPath, locNode, EventType.EVT_IGFS_DIR_CREATED)); evtPath = evtPath.parent(); assert evtPath != null; // If this fails, then ROOT does not exist. } } return true; }
/** * Sends a series of event. * * @param kernalCtx Kernal context. * @param path The path of the created file. * @param newPath New path. * @param type The type of event to send. */ public static void sendEvents(GridKernalContext kernalCtx, IgfsPath path, IgfsPath newPath, int type) { assert kernalCtx != null; assert path != null; GridEventStorageManager evts = kernalCtx.event(); ClusterNode locNode = kernalCtx.discovery().localNode(); if (evts.isRecordable(type)) { if (newPath == null) evts.record(new IgfsEvent(path, locNode, type)); else evts.record(new IgfsEvent(path, newPath, locNode, type)); } }
evts.record(new IgfsEvent(path, igfsCtx.localNode(), EVT_IGFS_FILE_CLOSED_READ, bytes()));
/** * Updates IGFS metrics when the stream is closed. */ protected void updateMetricsOnClose() { IgfsLocalMetrics metrics = igfsCtx.metrics(); metrics.addWrittenBytesTime(bytes, time); metrics.decrementFilesOpenedForWrite(); GridEventStorageManager evts = igfsCtx.kernalContext().event(); if (evts.isRecordable(EVT_IGFS_FILE_CLOSED_WRITE)) evts.record(new IgfsEvent(path, igfsCtx.localNode(), EVT_IGFS_FILE_CLOSED_WRITE, bytes)); }
evts.record(new IgfsEvent(path, igfsCtx.localNode(), EVT_IGFS_META_UPDATED, props));
pendingEvts.add(new IgfsEvent(path, locNode, EventType.EVT_IGFS_FILE_OPENED_WRITE));