You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/09/09 00:21:42 UTC

[GitHub] [ozone] GeorgeJahad commented on a diff in pull request #3729: HDDS-6855. [SNAPSHOTS] Path Based Access for Ozone Snapshots.

GeorgeJahad commented on code in PR #3729:
URL: https://github.com/apache/ozone/pull/3729#discussion_r966520714


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/lock/OmLock.java:
##########
@@ -0,0 +1,98 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.ozone.om.lock;
+
+import com.google.common.annotations.VisibleForTesting;
+
+/**
+ * Interface for OM Metadata locks.
+ */
+public interface OmLock {

Review Comment:
   will do



##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/lock/OmReadOnlyLock.java:
##########
@@ -0,0 +1,167 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.ozone.om.lock;
+
+/**
+ * Read only "lock" for snapshots
+ * Uses no lock.  Always returns true when aquiring
+ * read lock and false for write locks
+ */
+public class OmReadOnlyLock implements OmLock {
+  @Override
+  public boolean acquireLock(OzoneManagerLock.Resource resource,
+                             String... resources) {
+    return false;
+  }
+
+  @Override
+  public boolean acquireReadLock(OzoneManagerLock.Resource resource,
+                                 String... resources) {
+    return true;
+  }
+
+  @Override
+  public boolean acquireReadHashedLock(OzoneManagerLock.Resource resource,
+                                 String resourceName) {
+    return true;
+  }
+
+  @Override
+  public boolean acquireWriteLock(OzoneManagerLock.Resource resource,
+                                  String... resources) {
+    return false;
+  }
+
+  @Override
+  public boolean acquireWriteHashedLock(OzoneManagerLock.Resource resource,
+                                        String resourceName) {
+    return false;
+  }
+
+  @Override
+  public String generateResourceName(OzoneManagerLock.Resource resource,
+                                     String... resources) {
+    return "";
+  }
+
+  @Override
+  public boolean acquireMultiUserLock(String firstUser, String secondUser) {
+    return false;
+  }
+
+  @Override
+  public void releaseMultiUserLock(String firstUser, String secondUser) {
+

Review Comment:
   will do



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org