ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: Added "size".
Date Sun, 05 Jun 2016 15:47:21 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-3247 f029f51d9 -> ca2e06e4f


Added "size".


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

Branch: refs/heads/ignite-3247
Commit: ca2e06e4ff606fc7392ed3eafaabd0e5116d38ad
Parents: f029f51
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Sun Jun 5 18:47:13 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Sun Jun 5 18:47:13 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/igfs/IgfsImpl.java      |  4 ++
 .../igfs/client/IgfsClientSizeCallable.java     | 59 ++++++++++++++++++++
 2 files changed, 63 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ca2e06e4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 10a3f2f..18938ab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -64,6 +64,7 @@ import org.apache.ignite.internal.processors.igfs.client.IgfsClientListPathsCall
 import org.apache.ignite.internal.processors.igfs.client.IgfsClientMkdirsCallable;
 import org.apache.ignite.internal.processors.igfs.client.IgfsClientRenameCallable;
 import org.apache.ignite.internal.processors.igfs.client.IgfsClientSetTimesCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientSizeCallable;
 import org.apache.ignite.internal.processors.igfs.client.IgfsClientUpdateCallable;
 import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
@@ -1327,6 +1328,9 @@ public final class IgfsImpl implements IgfsEx {
     @Override public long size(final IgfsPath path) {
         A.notNull(path, "path");
 
+        if (meta.isClient())
+            return meta.runClientTask(new IgfsClientSizeCallable(cfg.getName(), path));
+
         return safeOp(new Callable<Long>() {
             @Override public Long call() throws Exception {
                 IgniteUuid nextId = meta.fileId(path);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ca2e06e4/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
new file mode 100644
index 0000000..474a940
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientSizeCallable.java
@@ -0,0 +1,59 @@
+/*
+ * 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;
+
+import org.apache.ignite.igfs.IgfsFile;
+import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.internal.processors.igfs.IgfsContext;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * IGFS client size callable.
+ */
+public class IgfsClientSizeCallable extends IgfsClientAbstractCallable<Long> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Default constructor.
+     */
+    public IgfsClientSizeCallable() {
+        // NO-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param igfsName IGFS name.
+     * @param path Path.
+     */
+    public IgfsClientSizeCallable(@Nullable String igfsName, IgfsPath path) {
+        super(igfsName, path);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Long call0(IgfsContext ctx) throws Exception {
+        return ctx.igfs().size(path);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(IgfsClientSizeCallable.class, this);
+    }
+}


Mime
View raw message