ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [42/50] ignite git commit: IGNITE-3332: IGFS: Implemented unlock task for client nodes.
Date Mon, 20 Jun 2016 12:53:22 GMT
IGNITE-3332: IGFS: Implemented unlock task for client nodes.


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

Branch: refs/heads/ignite-3341
Commit: df60f650e06f1b0782dd76277ae6415f3bc708e1
Parents: 06831b1
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Fri Jun 17 13:43:26 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Fri Jun 17 13:43:26 2016 +0300

----------------------------------------------------------------------
 .../processors/igfs/IgfsMetaManager.java        |  17 ++-
 .../igfs/client/IgfsClientAbstractCallable.java |  14 +-
 .../igfs/client/IgfsClientAffinityCallable.java |   5 -
 .../igfs/client/IgfsClientDeleteCallable.java   |   6 +-
 .../igfs/client/IgfsClientExistsCallable.java   |   5 -
 .../igfs/client/IgfsClientInfoCallable.java     |   5 -
 .../client/IgfsClientListFilesCallable.java     |   5 -
 .../client/IgfsClientListPathsCallable.java     |   5 -
 .../igfs/client/IgfsClientMkdirsCallable.java   |   5 +-
 .../igfs/client/IgfsClientRenameCallable.java   |   5 +-
 .../igfs/client/IgfsClientSetTimesCallable.java |   6 +-
 .../igfs/client/IgfsClientSizeCallable.java     |   5 -
 .../igfs/client/IgfsClientSummaryCallable.java  |   5 -
 .../igfs/client/IgfsClientUpdateCallable.java   |   5 +-
 .../meta/IgfsClientMetaFileUnlockCallable.java  | 130 +++++++++++++++++++
 .../meta/IgfsClientMetaIdsForPathCallable.java  |   5 -
 .../meta/IgfsClientMetaInfoForPathCallable.java |   5 -
 17 files changed, 175 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/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 30c7d10..8f1bb69 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
@@ -48,6 +48,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheInternal;
 import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.igfs.client.IgfsClientAbstractCallable;
+import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaFileUnlockCallable;
 import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaIdsForPathCallable;
 import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaInfoForPathCallable;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryCreateProcessor;
@@ -251,9 +252,14 @@ public class IgfsMetaManager extends IgfsManager {
      */
     <T> T runClientTask(IgfsClientAbstractCallable<T> task) {
         try {
-            if (!task.isReadOnly() && cfg.isColocateMetadata())
+            if (task.isAffinityBased() && cfg.isColocateMetadata()) {
                 // If task mutates state and co-location is enabled, we route request to
primary node.
-                return compute().affinityCall(cfg.getMetaCacheName(), IgfsUtils.ROOT_ID,
task);
+                IgniteUuid affKey = task.affinityKey();
+
+                assert affKey != null;
+
+                return compute().affinityCall(cfg.getMetaCacheName(), affKey, task);
+            }
             else
                 // Otherwise we route to any available data node.
                 return metaCompute().call(task);
@@ -673,6 +679,13 @@ public class IgfsMetaManager extends IgfsManager {
     public void unlock(final IgniteUuid fileId, final IgniteUuid lockId, final long modificationTime,
         final boolean updateSpace, final long space, @Nullable final IgfsFileAffinityRange
affRange)
         throws IgniteCheckedException {
+        if (isClient()) {
+            runClientTask(new IgfsClientMetaFileUnlockCallable(cfg.getName(), fileId, lockId,
modificationTime,
+                updateSpace, space, affRange));
+
+            return;
+        }
+
         validTxState(false);
 
         if (busyLock.enterBusy()) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientAbstractCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientAbstractCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientAbstractCallable.java
index c06619f..a41418f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientAbstractCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientAbstractCallable.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsContext;
 import org.apache.ignite.internal.processors.igfs.IgfsEx;
 import org.apache.ignite.internal.processors.igfs.IgfsUtils;
 import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.resources.IgniteInstanceResource;
 import org.jetbrains.annotations.Nullable;
 
@@ -88,7 +89,18 @@ public abstract class IgfsClientAbstractCallable<T> implements IgniteCallable<T>
     /**
      * @return {@code True} if task is read-only and does not change metadata.
      */
-    public abstract boolean isReadOnly();
+    @Nullable public IgniteUuid affinityKey() {
+        return null;
+    }
+
+    /**
+     * Whether this callable is affinity-based.
+     *
+     * @return {@code True} if affinity based.
+     */
+    public boolean isAffinityBased() {
+        return affinityKey() != null;
+    }
 
     /** {@inheritDoc} */
     @Override public final void writeBinary(BinaryWriter writer) throws BinaryObjectException
{

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientAffinityCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientAffinityCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientAffinityCallable.java
index 6e2748d..1668f36 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientAffinityCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientAffinityCallable.java
@@ -74,11 +74,6 @@ public class IgfsClientAffinityCallable extends IgfsClientAbstractCallable<Colle
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
     @Override public void writeBinary0(BinaryRawWriter writer) throws BinaryObjectException
{
         writer.writeLong(start);
         writer.writeLong(len);

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientDeleteCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientDeleteCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientDeleteCallable.java
index 21f8c46..31c158b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientDeleteCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientDeleteCallable.java
@@ -22,7 +22,9 @@ import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.binary.BinaryRawWriter;
 import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.processors.igfs.IgfsContext;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -61,8 +63,8 @@ public class IgfsClientDeleteCallable extends IgfsClientAbstractCallable<Boolean
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return false;
+    @Nullable @Override public IgniteUuid affinityKey() {
+        return IgfsUtils.ROOT_ID;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientExistsCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientExistsCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientExistsCallable.java
index 536cdc8..04b63d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientExistsCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientExistsCallable.java
@@ -52,11 +52,6 @@ public class IgfsClientExistsCallable extends IgfsClientAbstractCallable<Boolean
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgfsClientExistsCallable.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientInfoCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientInfoCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientInfoCallable.java
index 6bab8b8..f97c3c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientInfoCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientInfoCallable.java
@@ -53,11 +53,6 @@ public class IgfsClientInfoCallable extends IgfsClientAbstractCallable<IgfsFile>
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgfsClientInfoCallable.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListFilesCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListFilesCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListFilesCallable.java
index deb8836..325e714 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListFilesCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListFilesCallable.java
@@ -55,11 +55,6 @@ public class IgfsClientListFilesCallable extends IgfsClientAbstractCallable<Coll
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgfsClientListFilesCallable.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListPathsCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListPathsCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListPathsCallable.java
index ad6c858..78b4c84 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListPathsCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListPathsCallable.java
@@ -54,11 +54,6 @@ public class IgfsClientListPathsCallable extends IgfsClientAbstractCallable<Coll
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgfsClientListPathsCallable.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientMkdirsCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientMkdirsCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientMkdirsCallable.java
index 6ecb6ea..5c2a6ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientMkdirsCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientMkdirsCallable.java
@@ -24,6 +24,7 @@ import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.processors.igfs.IgfsContext;
 import org.apache.ignite.internal.processors.igfs.IgfsUtils;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Map;
@@ -66,8 +67,8 @@ public class IgfsClientMkdirsCallable extends IgfsClientAbstractCallable<Void>
{
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return false;
+    @Nullable @Override public IgniteUuid affinityKey() {
+        return IgfsUtils.ROOT_ID;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientRenameCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientRenameCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientRenameCallable.java
index 142af47..126b290 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientRenameCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientRenameCallable.java
@@ -24,6 +24,7 @@ import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.processors.igfs.IgfsContext;
 import org.apache.ignite.internal.processors.igfs.IgfsUtils;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -64,8 +65,8 @@ public class IgfsClientRenameCallable extends IgfsClientAbstractCallable<Void>
{
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return false;
+    @Nullable @Override public IgniteUuid affinityKey() {
+        return IgfsUtils.ROOT_ID;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSetTimesCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSetTimesCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSetTimesCallable.java
index 8c302bc..1e18690 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSetTimesCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSetTimesCallable.java
@@ -22,7 +22,9 @@ import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.binary.BinaryRawWriter;
 import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.processors.igfs.IgfsContext;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -69,8 +71,8 @@ public class IgfsClientSetTimesCallable extends IgfsClientAbstractCallable<Void>
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return false;
+    @Nullable @Override public IgniteUuid affinityKey() {
+        return IgfsUtils.ROOT_ID;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSizeCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSizeCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSizeCallable.java
index 29a7b7a..474a940 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSizeCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSizeCallable.java
@@ -53,11 +53,6 @@ public class IgfsClientSizeCallable extends IgfsClientAbstractCallable<Long>
{
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgfsClientSizeCallable.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSummaryCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSummaryCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSummaryCallable.java
index 1e2795c..7e29029 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSummaryCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSummaryCallable.java
@@ -53,11 +53,6 @@ public class IgfsClientSummaryCallable extends IgfsClientAbstractCallable<IgfsPa
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgfsClientSummaryCallable.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientUpdateCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientUpdateCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientUpdateCallable.java
index 82d6e8d..d9ffe56 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientUpdateCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientUpdateCallable.java
@@ -25,6 +25,7 @@ import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.processors.igfs.IgfsContext;
 import org.apache.ignite.internal.processors.igfs.IgfsUtils;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Map;
@@ -65,8 +66,8 @@ public class IgfsClientUpdateCallable extends IgfsClientAbstractCallable<IgfsFil
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return false;
+    @Nullable @Override public IgniteUuid affinityKey() {
+        return IgfsUtils.ROOT_ID;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaFileUnlockCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaFileUnlockCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaFileUnlockCallable.java
new file mode 100644
index 0000000..22e512a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaFileUnlockCallable.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.igfs.client.meta;
+
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.internal.binary.BinaryUtils;
+import org.apache.ignite.internal.processors.igfs.IgfsContext;
+import org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientAbstractCallable;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Callable to unlock file info.
+ */
+public class IgfsClientMetaFileUnlockCallable extends IgfsClientAbstractCallable<Void>
{
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** File ID. */
+    private IgniteUuid fileId;
+
+    /** Lock ID. */
+    private IgniteUuid lockId;
+
+    /** Modification time. */
+    private long modificationTime;
+
+    /** Whether to update space. */
+    private boolean updateSpace;
+
+    /** Space. */
+    private long space;
+
+    /** Affinity range. */
+    private IgfsFileAffinityRange affRange;
+
+    /**
+     * Default constructor.
+     */
+    public IgfsClientMetaFileUnlockCallable() {
+        // NO-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param igfsName IGFS name.
+     * @param fileId File ID.
+     * @param lockId Lock ID.
+     * @param modificationTime Modification time.
+     */
+    public IgfsClientMetaFileUnlockCallable(@Nullable String igfsName, IgniteUuid fileId,
IgniteUuid lockId,
+        long modificationTime, boolean updateSpace, long space, @Nullable IgfsFileAffinityRange
affRange) {
+        super(igfsName, null);
+
+        this.fileId = fileId;
+        this.lockId = lockId;
+        this.modificationTime = modificationTime;
+        this.updateSpace = updateSpace;
+        this.space = space;
+        this.affRange = affRange;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Void call0(IgfsContext ctx) throws Exception {
+        ctx.meta().unlock(fileId, lockId, modificationTime, updateSpace, space, affRange);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public IgniteUuid affinityKey() {
+        return fileId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary0(BinaryRawWriter writer) throws BinaryObjectException
{
+        BinaryUtils.writeIgniteUuid(writer, fileId);
+        BinaryUtils.writeIgniteUuid(writer, lockId);
+
+        writer.writeLong(modificationTime);
+
+        if (updateSpace) {
+            writer.writeBoolean(true);
+            writer.writeLong(space);
+            writer.writeObject(affRange);
+        }
+        else
+            writer.writeBoolean(false);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary0(BinaryRawReader reader) throws BinaryObjectException
{
+        fileId = BinaryUtils.readIgniteUuid(reader);
+        lockId = BinaryUtils.readIgniteUuid(reader);
+
+        modificationTime = reader.readLong();
+
+        if (reader.readBoolean()) {
+            updateSpace = true;
+
+            space = reader.readLong();
+            affRange = reader.readObject();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(IgfsClientMetaFileUnlockCallable.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaIdsForPathCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaIdsForPathCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaIdsForPathCallable.java
index b07a0cb..7b3d142 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaIdsForPathCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaIdsForPathCallable.java
@@ -59,11 +59,6 @@ public class IgfsClientMetaIdsForPathCallable extends IgfsClientAbstractCallable
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgfsClientMetaIdsForPathCallable.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/df60f650/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaInfoForPathCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaInfoForPathCallable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaInfoForPathCallable.java
index e7e0164..cb31663 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaInfoForPathCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaInfoForPathCallable.java
@@ -57,11 +57,6 @@ public class IgfsClientMetaInfoForPathCallable extends IgfsClientAbstractCallabl
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isReadOnly() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgfsClientMetaInfoForPathCallable.class, this);
     }


Mime
View raw message