ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [2/2] ignite git commit: IGNITE-2813: WIP.
Date Wed, 16 Mar 2016 15:54:34 GMT
IGNITE-2813: WIP.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ff9f6254
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ff9f6254
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ff9f6254

Branch: refs/heads/ignite-2813
Commit: ff9f62546216ff5792ea1a4f9c0ef86f5f4fd6dd
Parents: 0dd72a45
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Mar 16 18:54:23 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Mar 16 18:54:23 2016 +0300

----------------------------------------------------------------------
 .../processors/igfs/IgfsDataManager.java        |  2 +-
 .../internal/processors/igfs/IgfsFileInfo.java  | 48 +-------------
 .../processors/igfs/IgfsMetaManager.java        | 10 +--
 .../internal/processors/igfs/IgfsUtils.java     | 68 ++++++++++++++++++++
 .../processors/igfs/IgfsFileInfoSelfTest.java   |  2 +-
 .../igfs/IgfsMetaManagerSelfTest.java           |  2 +-
 .../processors/igfs/IgfsSizeSelfTest.java       |  4 +-
 .../fs/IgniteHadoopIgfsSecondaryFileSystem.java |  2 +-
 8 files changed, 80 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ff9f6254/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
index a11a2fe..b77b926 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
@@ -1648,7 +1648,7 @@ public class IgfsDataManager extends IgfsManager {
 
             long time = System.currentTimeMillis();
 
-            stopInfo = IgfsFileInfo.createDirectory(IgniteUuid.randomUuid());
+            stopInfo = IgfsUtils.createDirectory(IgniteUuid.randomUuid());
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff9f6254/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileInfo.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileInfo.java
index a11de7f..60f119d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileInfo.java
@@ -83,52 +83,6 @@ public final class IgfsFileInfo implements Externalizable {
     }
 
     /**
-     * Create empty directory with the given ID.
-     *
-     * @param id ID.
-     * @return File info.
-     */
-    public static IgfsFileInfo createDirectory(IgniteUuid id) {
-        return createDirectory(id, null, null);
-    }
-
-    /**
-     * Craete directory.
-     *
-     * @param id ID.
-     * @param listing Listing.
-     * @param props Properties.
-     * @return File info.
-     */
-    public static IgfsFileInfo createDirectory(
-        IgniteUuid id,
-        @Nullable Map<String, IgfsListingEntry> listing,
-        @Nullable Map<String, String> props) {
-        long time = System.currentTimeMillis();
-
-        return createDirectory(id, listing, props, time, time);
-    }
-
-    /**
-     * Create directory.
-     *
-     * @param id ID.
-     * @param listing Listing.
-     * @param props Properties.
-     * @param createTime Create time.
-     * @param modificationTime Modification time.
-     * @return File info.
-     */
-    public static IgfsFileInfo createDirectory(
-        IgniteUuid id,
-        @Nullable Map<String, IgfsListingEntry> listing,
-        @Nullable Map<String,String> props,
-        long createTime,
-        long modificationTime) {
-        return new IgfsFileInfo(true, id, 0, 0, null, listing, props, null, null, createTime,
modificationTime, false);
-    }
-
-    /**
      * Create file.
      *
      * @param id File ID.
@@ -293,7 +247,7 @@ public final class IgfsFileInfo implements Externalizable {
      * @param modificationTime Last modification time.
      * @param evictExclude Evict exclude flag.
      */
-    private IgfsFileInfo(boolean isDir, IgniteUuid id, int blockSize, long len, @Nullable
IgniteUuid affKey,
+    IgfsFileInfo(boolean isDir, IgniteUuid id, int blockSize, long len, @Nullable IgniteUuid
affKey,
         @Nullable Map<String, IgfsListingEntry> listing, @Nullable Map<String, String>
props,
         @Nullable IgfsFileMap fileMap, @Nullable IgniteUuid lockId, long accessTime,
         long modificationTime, boolean evictExclude) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff9f6254/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 6541f5e..b5b1ab4 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
@@ -664,7 +664,7 @@ public class IgfsMetaManager extends IgfsManager {
 
         long time = System.currentTimeMillis();
 
-        IgfsFileInfo info = IgfsFileInfo.createDirectory(id);
+        IgfsFileInfo info = IgfsUtils.createDirectory(id);
 
         IgfsFileInfo oldInfo = id2InfoPrj.getAndPutIfAbsent(id, info);
 
@@ -1078,7 +1078,7 @@ public class IgfsMetaManager extends IgfsManager {
                     // Construct new info and move locked entries from root to it.
                     Map<String, IgfsListingEntry> transferListing = new HashMap<>(rootListingMap);
 
-                    IgfsFileInfo newInfo = IgfsFileInfo.createDirectory(
+                    IgfsFileInfo newInfo = IgfsUtils.createDirectory(
                         IgniteUuid.randomUuid(),
                         transferListing,
                         (Map<String,String>)null
@@ -1256,7 +1256,7 @@ public class IgfsMetaManager extends IgfsManager {
 
                 transferListing.putAll(rootListing);
 
-                IgfsFileInfo newInfo = IgfsFileInfo.createDirectory(
+                IgfsFileInfo newInfo = IgfsUtils.createDirectory(
                     IgniteUuid.randomUuid(),
                     transferListing,
                     (Map<String,String>)null
@@ -2624,7 +2624,7 @@ public class IgfsMetaManager extends IgfsManager {
 
                 // Recreate the path locally.
                 IgfsFileInfo curInfo = status.isDirectory() ?
-                    IgfsFileInfo.createDirectory(
+                    IgfsUtils.createDirectory(
                         IgniteUuid.randomUuid(),
                         null,
                         status.properties(),
@@ -3878,7 +3878,7 @@ public class IgfsMetaManager extends IgfsManager {
         @Override public IgfsFileInfo process(MutableEntry<IgniteUuid, IgfsFileInfo>
entry, Object... args)
             throws EntryProcessorException {
 
-            IgfsFileInfo info = IgfsFileInfo.createDirectory(
+            IgfsFileInfo info = IgfsUtils.createDirectory(
                 entry.getKey(),
                 null,
                 props,

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff9f6254/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index edded2f..db04612 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.igfs;
 
 import java.lang.reflect.Constructor;
+import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.ThreadLocalRandom;
 
@@ -253,4 +254,71 @@ public class IgfsUtils {
         if (evts.isRecordable(type))
             evts.record(new IgfsEvent(path, locNode, type));
     }
+
+    /**
+     * Create empty directory with the given ID.
+     *
+     * @param id ID.
+     * @return File info.
+     */
+    public static IgfsFileInfo createDirectory(IgniteUuid id) {
+        return createDirectory(id, null, null);
+    }
+
+    /**
+     * Create directory.
+     *
+     * @param id ID.
+     * @param listing Listing.
+     * @param props Properties.
+     * @return File info.
+     */
+    public static IgfsFileInfo createDirectory(
+        IgniteUuid id,
+        @Nullable Map<String, IgfsListingEntry> listing,
+        @Nullable Map<String, String> props) {
+        long time = System.currentTimeMillis();
+
+        return createDirectory(id, listing, props, time, time);
+    }
+
+    /**
+     * Create directory.
+     *
+     * @param id ID.
+     * @param listing Listing.
+     * @param props Properties.
+     * @param createTime Create time.
+     * @param modificationTime Modification time.
+     * @return File info.
+     */
+    public static IgfsFileInfo createDirectory(
+        IgniteUuid id,
+        @Nullable Map<String, IgfsListingEntry> listing,
+        @Nullable Map<String,String> props,
+        long createTime,
+        long modificationTime) {
+        return new IgfsFileInfo(true, id, 0, 0, null, listing, props, null, null, createTime,
modificationTime, false);
+    }
+
+    /**
+     * Create file.
+     *
+     * @param id File ID.
+     * @param blockSize Block size.
+     * @param len Length.
+     * @param affKey Affinity key.
+     * @param lockId Lock ID.
+     * @param evictExclude Evict exclude flag.
+     * @param props Properties.
+     * @param accessTime Access time.
+     * @param modificationTime Modification time.
+     * @return File info.
+     */
+    public static IgfsFileInfo createFile(IgniteUuid id, int blockSize, long len, @Nullable
IgniteUuid affKey,
+        @Nullable IgniteUuid lockId, boolean evictExclude, @Nullable Map<String, String>
props, long accessTime,
+        long modificationTime) {
+        return new IgfsFileInfo(false, id, blockSize, len, affKey, null, props, null, lockId,
+            accessTime, modificationTime, evictExclude);
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff9f6254/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsFileInfoSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsFileInfoSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsFileInfoSelfTest.java
index 1d25394..8a6ad9f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsFileInfoSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsFileInfoSelfTest.java
@@ -49,7 +49,7 @@ public class IgfsFileInfoSelfTest extends IgfsCommonAbstractTest {
 
             @SuppressWarnings("deprecation") // Suppress due to default constructor should
never be used directly.
             @Nullable @Override public Object call() throws IgniteCheckedException {
-                testSerialization(IgfsFileInfo.createDirectory(IgniteUuid.randomUuid()));
+                testSerialization(IgfsUtils.createDirectory(IgniteUuid.randomUuid()));
 
                 return null;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff9f6254/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
index dc790e2..5770956 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
@@ -227,7 +227,7 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testStructure() throws Exception {
-        IgfsFileInfo rootInfo = IgfsFileInfo.createDirectory(ROOT_ID);
+        IgfsFileInfo rootInfo = IgfsUtils.createDirectory(ROOT_ID);
 
         // Test empty structure.
         assertEmpty(mgr.directoryListing(ROOT_ID));

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff9f6254/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
index 395296e..744991c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
@@ -543,13 +543,13 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest {
                     new IgfsListingEntry(info));
 
                 // Clear root listing.
-                metaCache.put(IgfsUtils.ROOT_ID, IgfsFileInfo.createDirectory(IgfsUtils.ROOT_ID));
+                metaCache.put(IgfsUtils.ROOT_ID, IgfsUtils.createDirectory(IgfsUtils.ROOT_ID));
 
                 // Add file to trash listing.
                 IgfsFileInfo trashInfo = metaCache.get(trashId);
 
                 if (trashInfo == null)
-                    metaCache.put(trashId, IgfsFileInfo.createDirectory(trashId).listing(listing));
+                    metaCache.put(trashId, IgfsUtils.createDirectory(trashId).listing(listing));
                 else
                     metaCache.put(trashId, trashInfo.listing(listing));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff9f6254/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
index 970b6d2..d1879b2 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
@@ -353,7 +353,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
 
             for (FileStatus s : statuses) {
                 IgfsFileInfo fsInfo = s.isDirectory() ?
-                    IgfsFileInfo.createDirectory(
+                    IgfsUtils.createDirectory(
                         IgniteUuid.randomUuid(),
                         null,
                         properties(s),


Mime
View raw message