You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/03/18 12:02:28 UTC
ignite git commit: Removed dir builder and added missing SUID.
Repository: ignite
Updated Branches:
refs/heads/ignite-igfs-refactoring e7830cd80 -> 0fc0abb63
Removed dir builder and added missing SUID.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0fc0abb6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0fc0abb6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0fc0abb6
Branch: refs/heads/ignite-igfs-refactoring
Commit: 0fc0abb63714e6d39ac4eff8f347afd7e128096f
Parents: e7830cd
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Mar 18 14:02:15 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Mar 18 14:02:15 2016 +0300
----------------------------------------------------------------------
.../processors/igfs/IgfsMetaManager.java | 218 +------------------
1 file changed, 3 insertions(+), 215 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0fc0abb6/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
index d930bd8..82d5811 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
@@ -3265,6 +3265,9 @@ public class IgfsMetaManager extends IgfsManager {
*/
private static final class ListingReplaceProcessor implements EntryProcessor<IgniteUuid, IgfsFileInfo, Void>,
Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
/** Name. */
private String name;
@@ -3728,221 +3731,6 @@ public class IgfsMetaManager extends IgfsManager {
}
}
- /** File chain builder. */
- private class DirectoryChainBuilder {
- /** The requested path to be created. */
- private final IgfsPath path;
-
- /** Full path components. */
- private final List<String> components;
-
- /** The list of ids. */
- private final List<IgniteUuid> idList;
-
- /** The set of ids. */
- private final SortedSet<IgniteUuid> idSet = new TreeSet<IgniteUuid>(PATH_ID_SORTING_COMPARATOR);
-
- /** The middle node properties. */
- private final Map<String, String> props;
-
- /** The leaf node properties. */
- private final Map<String, String> leafProps;
-
- /** The lowermost exsiting path id. */
- private final IgniteUuid lowermostExistingId;
-
- /** The existing path. */
- private final IgfsPath existingPath;
-
- /** The created leaf info. */
- private IgfsFileInfo leafInfo;
-
- /** The leaf parent id. */
- private IgniteUuid leafParentId;
-
- /** The number of existing ids. */
- private final int existingIdCnt;
-
- /** Whether laef is directory. */
- private final boolean leafDir;
-
- /** Block size. */
- private final int blockSize;
-
- /** Affinity key. */
- private final IgniteUuid affKey;
-
- /** Evict exclude flag. */
- private final boolean evictExclude;
-
- /**
- * Constructor for directories.
- *
- * @param path Path.
- * @param props Properties.
- * @throws IgniteCheckedException If failed.
- */
- protected DirectoryChainBuilder(IgfsPath path, Map<String, String> props) throws IgniteCheckedException {
- this(path, props, props, true, 0, null, false);
- }
-
- /**
- * Constructor for files.
- *
- * @param path Path.
- * @param dirProps Directory properties.
- * @param fileProps File properties.
- * @param blockSize Block size.
- * @param affKey Affinity key (optional).
- * @param evictExclude Evict exclude flag.
- * @throws IgniteCheckedException If failed.
- */
- protected DirectoryChainBuilder(IgfsPath path, Map<String, String> dirProps, Map<String, String> fileProps,
- int blockSize, @Nullable IgniteUuid affKey, boolean evictExclude)
- throws IgniteCheckedException {
- this(path, dirProps, fileProps, false, blockSize, affKey, evictExclude);
- }
-
- /**
- * Constructor.
- *
- * @param path Path.
- * @param props Middle properties.
- * @param leafProps Leaf properties.
- * @param leafDir Whether leaf is directory or file.
- * @param blockSize Block size.
- * @param affKey Affinity key (optional).
- * @param evictExclude Evict exclude flag.
- * @throws IgniteCheckedException If failed.
- */
- private DirectoryChainBuilder(IgfsPath path, Map<String,String> props, Map<String,String> leafProps,
- boolean leafDir, int blockSize, @Nullable IgniteUuid affKey, boolean evictExclude)
- throws IgniteCheckedException {
- this.path = path;
- this.components = path.components();
- this.idList = fileIds(path);
- this.props = props;
- this.leafProps = leafProps;
- this.leafDir = leafDir;
- this.blockSize = blockSize;
- this.affKey = affKey;
- this.evictExclude = evictExclude;
-
- // Store all the non-null ids in the set & construct existing path in one loop:
- IgfsPath existingPath = path.root();
-
- assert idList.size() == components.size() + 1;
-
- // Find the lowermost existing id:
- IgniteUuid lowermostExistingId = null;
-
- int idIdx = 0;
-
- for (IgniteUuid id : idList) {
- if (id == null)
- break;
-
- lowermostExistingId = id;
-
- boolean added = idSet.add(id);
-
- assert added : "Not added id = " + id;
-
- if (idIdx >= 1) // skip root.
- existingPath = new IgfsPath(existingPath, components.get(idIdx - 1));
-
- idIdx++;
- }
-
- assert idSet.contains(IgfsUtils.ROOT_ID);
-
- this.lowermostExistingId = lowermostExistingId;
-
- this.existingPath = existingPath;
-
- this.existingIdCnt = idSet.size();
- }
-
- /**
- * Does the main portion of job building the renmaining path.
- */
- public final void doBuild() throws IgniteCheckedException {
- // Fix current time. It will be used in all created entities.
- long createTime = System.currentTimeMillis();
-
- IgfsListingEntry childInfo = null;
- String childName = null;
-
- IgniteUuid parentId = null;
-
- // This loop creates the missing directory chain from the bottom to the top:
- for (int i = components.size() - 1; i >= existingIdCnt - 1; i--) {
- IgniteUuid childId = IgniteUuid.randomUuid();
- boolean childDir;
-
- if (childName == null) {
- assert childInfo == null;
-
- if (leafDir) {
- childDir = true;
-
- leafInfo = invokeAndGet(childId, new DirectoryCreateProcessor(createTime, leafProps));
- }
- else {
- childDir = false;
-
- leafInfo = invokeAndGet(childId, new FileCreateProcessor(createTime, leafProps, blockSize,
- affKey, createFileLockId(false), evictExclude));
- }
- }
- else {
- assert childInfo != null;
-
- childDir = true;
-
- id2InfoPrj.invoke(childId, new DirectoryCreateProcessor(createTime, props, childName, childInfo));
-
- if (parentId == null)
- parentId = childId;
- }
-
- childInfo = new IgfsListingEntry(childId, childDir);
-
- childName = components.get(i);
- }
-
- if (parentId == null)
- parentId = lowermostExistingId;
-
- leafParentId = parentId;
-
- // Now link the newly created directory chain to the lowermost existing parent:
- id2InfoPrj.invoke(lowermostExistingId, new ListingAddProcessor(childName, childInfo));
- }
-
- /**
- * Sends events.
- */
- public final void sendEvents() {
- if (evts.isRecordable(EVT_IGFS_DIR_CREATED)) {
- IgfsPath createdPath = existingPath;
-
- for (int i = existingPath.components().size(); i < components.size() - 1; i++) {
- createdPath = new IgfsPath(createdPath, components.get(i));
-
- IgfsUtils.sendEvents(igfsCtx.kernalContext(), createdPath, EVT_IGFS_DIR_CREATED);
- }
- }
-
- if (leafDir)
- IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, EVT_IGFS_DIR_CREATED);
- else {
- IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, EVT_IGFS_FILE_CREATED);
- IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, EVT_IGFS_FILE_OPENED_WRITE);
- }
- }
- }
-
/**
* File create processor.
*/