ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: Implemented unlock routine for client.
Date Wed, 08 Jun 2016 07:23:41 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-3264 ec0c52dba -> 9939ba0fe


Implemented unlock routine for client.


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

Branch: refs/heads/ignite-3264
Commit: 9939ba0fe83293ad76c0127668b057a5eb93c638
Parents: ec0c52d
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Jun 8 10:23:34 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Jun 8 10:23:34 2016 +0300

----------------------------------------------------------------------
 .../processors/igfs/IgfsMetaManager.java        |   8 ++
 .../meta/IgfsClientMetaFileUnlockCallable.java  | 132 +++++++++++++++++++
 2 files changed, 140 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9939ba0f/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 91bb334..0c5bb52 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;
@@ -639,6 +640,13 @@ public class IgfsMetaManager extends IgfsManager {
         throws IgniteCheckedException {
         validTxState(false);
 
+        if (client) {
+            runClientTask(new IgfsClientMetaFileUnlockCallable(cfg.getName(), fileId, lockId,
modificationTime,
+                updateSpace, space, affRange));
+
+            return;
+        }
+
         if (busyLock.enterBusy()) {
             try {
                 if (lockId == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/9939ba0f/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..7cafe06
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaFileUnlockCallable.java
@@ -0,0 +1,132 @@
+/*
+ * 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.IgfsMetaManager;
+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;
+
+/**
+ * IGFS client callable to unlock the file.
+ */
+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;
+
+    /** Affintiy 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.
+     * @param updateSpace Whether to update space.
+     * @param space Space.
+     * @param affRange Affintiy range.
+     */
+    public IgfsClientMetaFileUnlockCallable(@Nullable String igfsName, IgniteUuid fileId,
IgniteUuid lockId,
+        long modificationTime, boolean updateSpace, long space, 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 {
+        IgfsMetaManager meta =  ctx.meta();
+
+        meta.unlock(fileId, lockId, modificationTime, updateSpace, space, affRange);
+
+        return null;
+    }
+
+    /** {@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();
+        }
+        else
+            updateSpace = false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(IgfsClientMetaFileUnlockCallable.class, this);
+    }
+}


Mime
View raw message