diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java index fd3d214a90db..8ab04a3e6c91 100644 --- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java +++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java @@ -81,7 +81,9 @@ protected ObjectStore() { proxy = null; } - @VisibleForTesting + /** + * Returns the ClientProtocol of the ObjectStore. + */ public ClientProtocol getClientProxy() { return proxy; } diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java index a3f56a95b335..125cd2e4f42e 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java @@ -121,7 +121,7 @@ public TestRootedOzoneFileSystem(boolean setDefaultFs, private static FileSystem fs; private static RootedOzoneFileSystem ofs; private static ObjectStore objectStore; - private static BasicRootedOzoneClientAdapterImpl adapter; + private static BasicRootedOzoneFileSystemHelper helper; private static Trash trash; private static String volumeName; @@ -164,7 +164,7 @@ public static void init() throws Exception { TrashPolicy.class); trash = new Trash(conf); ofs = (RootedOzoneFileSystem) fs; - adapter = (BasicRootedOzoneClientAdapterImpl) ofs.getAdapter(); + helper = ofs.getHelper(); } @AfterClass @@ -696,7 +696,7 @@ private void listStatusRecursiveHelper(Path curPath, List result) */ private List callAdapterListStatus(String pathStr, boolean recursive, String startPath, long numEntries) throws IOException { - return adapter.listStatus(pathStr, recursive, startPath, numEntries, + return helper.listStatus(pathStr, recursive, startPath, numEntries, ofs.getUri(), ofs.getWorkingDirectory(), ofs.getUsername()) .stream().map(ofs::convertFileStatus).collect(Collectors.toList()); } diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java index f9bee5400d50..9710cf4f23d0 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java @@ -228,11 +228,6 @@ public void renameKey(String key, String newKeyName) throws IOException { bucket.renameKey(key, newKeyName); } - @Override - public void rename(String pathStr, String newPath) throws IOException { - throw new IOException("Please use renameKey instead for o3fs."); - } - /** * Helper method to create an directory specified by key name in bucket. * diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java index 3f45c3f131f9..d6680edc88d8 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java @@ -98,8 +98,8 @@ public class BasicRootedOzoneFileSystem extends FileSystem { private URI uri; private String userName; private Path workingDir; - private OzoneClientAdapter adapter; - private BasicRootedOzoneClientAdapterImpl adapterImpl; + // Using impl directly rather than OzoneClientAdapter in OFS. + private BasicRootedOzoneFileSystemHelper helper; private static final String URI_EXCEPTION_TEXT = "URL should be one of the following formats: " + @@ -145,8 +145,8 @@ public void initialize(URI name, Configuration conf) throws IOException { LOG.trace("Ozone URI for OFS initialization is " + uri); ConfigurationSource source = getConfSource(); - this.adapter = createAdapter(source, omHostOrServiceId, omPort); - this.adapterImpl = (BasicRootedOzoneClientAdapterImpl) this.adapter; + this.helper = new BasicRootedOzoneFileSystemHelper( + omHostOrServiceId, omPort, source); try { this.userName = @@ -163,15 +163,10 @@ public void initialize(URI name, Configuration conf) throws IOException { } } - protected OzoneClientAdapter createAdapter(ConfigurationSource conf, - String omHost, int omPort) throws IOException { - return new BasicRootedOzoneClientAdapterImpl(omHost, omPort, conf); - } - @Override public void close() throws IOException { try { - adapter.close(); + helper.close(); } finally { super.close(); } @@ -194,7 +189,7 @@ public FSDataInputStream open(Path path, int bufferSize) throws IOException { LOG.trace("open() path: {}", path); final String key = pathToKey(path); return new FSDataInputStream( - new OzoneFSInputStream(adapter.readFile(key), statistics)); + new OzoneFSInputStream(helper.readFile(key), statistics)); } protected void incrementCounter(Statistic statistic) { @@ -234,7 +229,7 @@ public FSDataOutputStream createNonRecursive(Path path, private FSDataOutputStream createOutputStream(String key, short replication, boolean overwrite, boolean recursive) throws IOException { - return new FSDataOutputStream(adapter.createFile(key, + return new FSDataOutputStream(helper.createFile(key, replication, overwrite, recursive), statistics); } @@ -249,7 +244,6 @@ private class RenameIterator extends OzoneListingIterator { private final String srcPath; private final String dstPath; private final OzoneBucket bucket; - private final BasicRootedOzoneClientAdapterImpl adapterImpl; RenameIterator(Path srcPath, Path dstPath) throws IOException { @@ -259,16 +253,14 @@ private class RenameIterator extends OzoneListingIterator { LOG.trace("rename from:{} to:{}", this.srcPath, this.dstPath); // Initialize bucket here to reduce number of RPC calls OFSPath ofsPath = new OFSPath(srcPath); - // TODO: Refactor later. - adapterImpl = (BasicRootedOzoneClientAdapterImpl) adapter; - this.bucket = adapterImpl.getBucket(ofsPath, false); + this.bucket = helper.getBucket(ofsPath, false); } @Override boolean processKeyPath(List keyPathList) throws IOException { for (String keyPath : keyPathList) { String newPath = dstPath.concat(keyPath.substring(srcPath.length())); - adapterImpl.rename(this.bucket, keyPath, newPath); + helper.rename(this.bucket, keyPath, newPath); } return true; } @@ -411,7 +403,6 @@ protected void rename(final Path src, final Path dst, private class DeleteIterator extends OzoneListingIterator { private final boolean recursive; private final OzoneBucket bucket; - private final BasicRootedOzoneClientAdapterImpl adapterImpl; DeleteIterator(Path f, boolean recursive) throws IOException { @@ -424,15 +415,13 @@ && listStatus(f).length != 0) { } // Initialize bucket here to reduce number of RPC calls OFSPath ofsPath = new OFSPath(f); - // TODO: Refactor later. - adapterImpl = (BasicRootedOzoneClientAdapterImpl) adapter; - this.bucket = adapterImpl.getBucket(ofsPath, false); + this.bucket = helper.getBucket(ofsPath, false); } @Override boolean processKeyPath(List keyPathList) { LOG.trace("Deleting keys: {}", keyPathList); - boolean succeed = adapterImpl.deleteObjects(this.bucket, keyPathList); + boolean succeed = helper.deleteObjects(this.bucket, keyPathList); // if recursive delete is requested ignore the return value of // deleteObject and issue deletes for other keys. return recursive || succeed; @@ -505,8 +494,7 @@ public boolean delete(Path f, boolean recursive) throws IOException { String volumeName = ofsPath.getVolumeName(); if (recursive) { // Delete all buckets first - OzoneVolume volume = - adapterImpl.getObjectStore().getVolume(volumeName); + OzoneVolume volume = helper.getVolumeDetails(volumeName); Iterator it = volume.listBuckets(""); String prefixVolumePathStr = addTrailingSlashIfNeeded(f.toString()); while (it.hasNext()) { @@ -516,7 +504,7 @@ public boolean delete(Path f, boolean recursive) throws IOException { } } try { - adapterImpl.getObjectStore().deleteVolume(volumeName); + helper.deleteVolume(volumeName); return true; } catch (OMException ex) { // volume is not empty @@ -532,8 +520,7 @@ public boolean delete(Path f, boolean recursive) throws IOException { // Handle delete bucket if (ofsPath.isBucket()) { - OzoneVolume volume = - adapterImpl.getObjectStore().getVolume(ofsPath.getVolumeName()); + OzoneVolume volume = helper.getVolumeDetails(ofsPath.getVolumeName()); try { volume.deleteBucket(ofsPath.getBucketName()); return result; @@ -549,7 +536,7 @@ public boolean delete(Path f, boolean recursive) throws IOException { } else { LOG.debug("delete: Path is a file: {}", f); - result = adapter.deleteObject(key); + result = helper.deleteObject(key); } if (result) { @@ -586,7 +573,7 @@ private void createFakeDirectoryIfNecessary(Path f) throws IOException { if (!key.isEmpty() && !o3Exists(f)) { LOG.debug("Creating new fake directory at {}", f); String dirKey = addTrailingSlashIfNeeded(key); - adapter.createDirectory(dirKey); + helper.createDirectory(dirKey); } } @@ -619,7 +606,7 @@ public FileStatus[] listStatus(Path f) throws IOException { do { tmpStatusList = - adapter.listStatus(pathToKey(f), false, startPath, + helper.listStatus(pathToKey(f), false, startPath, numEntries, uri, workingDir, getUsername()) .stream() .map(this::convertFileStatus) @@ -653,7 +640,7 @@ public Path getWorkingDirectory() { @Override public Token getDelegationToken(String renewer) throws IOException { - return adapter.getDelegationToken(renewer); + return helper.getDelegationToken(renewer); } /** @@ -664,7 +651,7 @@ public Token getDelegationToken(String renewer) throws IOException { */ @Override public String getCanonicalServiceName() { - return adapter.getCanonicalServiceName(); + return helper.getCanonicalServiceName(); } /** @@ -697,7 +684,7 @@ public Path getTrashRoot(Path path) { public Collection getTrashRoots(boolean allUsers) { // Since get all trash roots for one or more users requires listing all // volumes and buckets, we will let adapter impl handle it. - return adapterImpl.getTrashRoots(allUsers, this); + return helper.getTrashRoots(allUsers, this); } /** @@ -708,7 +695,7 @@ public Collection getTrashRoots(boolean allUsers) { * @throws IOException */ private boolean mkdir(Path path) throws IOException { - return adapter.createDirectory(pathToKey(path)); + return helper.createDirectory(pathToKey(path)); } @Override @@ -742,7 +729,7 @@ public FileStatus getFileStatus(Path f) throws IOException { FileStatus fileStatus = null; try { fileStatus = convertFileStatus( - adapter.getFileStatus(key, uri, qualifiedPath, getUsername())); + helper.getFileStatus(key, uri, qualifiedPath, getUsername())); } catch (OMException ex) { if (ex.getResult().equals(OMException.ResultCodes.KEY_NOT_FOUND) || ex.getResult().equals(OMException.ResultCodes.BUCKET_NOT_FOUND) || @@ -766,7 +753,7 @@ public BlockLocation[] getFileBlockLocations(FileStatus fileStatus, @Override public short getDefaultReplication() { - return adapter.getDefaultReplication(); + return helper.getDefaultReplication(); } @Override @@ -912,7 +899,7 @@ private abstract class OzoneListingIterator { if (status.isDirectory()) { this.pathKey = addTrailingSlashIfNeeded(pathKey); } - keyIterator = adapter.listKeys(pathKey); + keyIterator = helper.listKeys(pathKey); } /** @@ -989,8 +976,8 @@ FileStatus getStatus() { } } - public OzoneClientAdapter getAdapter() { - return adapter; + public BasicRootedOzoneFileSystemHelper getHelper() { + return helper; } public boolean isEmpty(CharSequence cs) { diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystemHelper.java similarity index 94% rename from hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java rename to hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystemHelper.java index 2bf6ee398124..caa44b32a9cc 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystemHelper.java @@ -1,4 +1,4 @@ -/** +/* * 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 @@ -6,9 +6,9 @@ * 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 - *

+ * + * 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. @@ -40,6 +40,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.hdds.annotation.InterfaceAudience; +import org.apache.hadoop.hdds.annotation.InterfaceStability; import org.apache.hadoop.hdds.client.ReplicationFactor; import org.apache.hadoop.hdds.client.ReplicationType; import org.apache.hadoop.hdds.conf.ConfigurationSource; @@ -83,19 +84,22 @@ .BUCKET_NOT_FOUND; /** - * Basic Implementation of the RootedOzoneFileSystem calls. - *

+ * Helper implementation of RootedOzoneFileSystem (OFS) calls. + * + * Previously BasicRootedOzoneClientAdapterImpl. Might be merged with + * BasicRootedOzoneFileSystem in the future. + * * This is the minimal version which doesn't include any statistics. - *

+ * * For full featured version use RootedOzoneClientAdapterImpl. */ -public class BasicRootedOzoneClientAdapterImpl - implements OzoneClientAdapter { +@InterfaceAudience.Private +@InterfaceStability.Evolving +public class BasicRootedOzoneFileSystemHelper { static final Logger LOG = - LoggerFactory.getLogger(BasicRootedOzoneClientAdapterImpl.class); + LoggerFactory.getLogger(BasicRootedOzoneFileSystemHelper.class); - private OzoneClient ozoneClient; private ObjectStore objectStore; private ClientProtocol proxy; private ReplicationType replicationType; @@ -108,7 +112,7 @@ public class BasicRootedOzoneClientAdapterImpl * * @throws IOException In case of a problem. */ - public BasicRootedOzoneClientAdapterImpl() throws IOException { + public BasicRootedOzoneFileSystemHelper() throws IOException { this(createConf()); } @@ -123,12 +127,12 @@ private static OzoneConfiguration createConf() { } } - public BasicRootedOzoneClientAdapterImpl(OzoneConfiguration conf) + public BasicRootedOzoneFileSystemHelper(OzoneConfiguration conf) throws IOException { this(null, -1, conf); } - public BasicRootedOzoneClientAdapterImpl(String omHost, int omPort, + public BasicRootedOzoneFileSystemHelper(String omHost, int omPort, ConfigurationSource hadoopConf) throws IOException { ClassLoader contextClassLoader = @@ -174,17 +178,15 @@ public BasicRootedOzoneClientAdapterImpl(String omHost, int omPort, int replicationCountConf = conf.getInt(OzoneConfigKeys.OZONE_REPLICATION, OzoneConfigKeys.OZONE_REPLICATION_DEFAULT); + OzoneClient ozoneClient; if (OmUtils.isOmHAServiceId(conf, omHost)) { // omHost is listed as one of the service ids in the config, // thus we should treat omHost as omServiceId - this.ozoneClient = - OzoneClientFactory.getRpcClient(omHost, conf); + ozoneClient = OzoneClientFactory.getRpcClient(omHost, conf); } else if (StringUtils.isNotEmpty(omHost) && omPort != -1) { - this.ozoneClient = - OzoneClientFactory.getRpcClient(omHost, omPort, conf); + ozoneClient = OzoneClientFactory.getRpcClient(omHost, omPort, conf); } else { - this.ozoneClient = - OzoneClientFactory.getRpcClient(conf); + ozoneClient = OzoneClientFactory.getRpcClient(conf); } objectStore = ozoneClient.getObjectStore(); proxy = objectStore.getClientProxy(); @@ -241,7 +243,7 @@ private OzoneBucket getBucket(String volumeStr, String bucketStr, if (getVolEx.getResult().equals(VOLUME_NOT_FOUND)) { // Volume doesn't exist. Create it try { - objectStore.createVolume(volumeStr); + proxy.createVolume(volumeStr); } catch (OMException newVolEx) { // Ignore the case where another client created the volume if (!newVolEx.getResult().equals(VOLUME_ALREADY_EXISTS)) { @@ -274,17 +276,14 @@ private OzoneBucket getBucket(String volumeStr, String bucketStr, return bucket; } - @Override public short getDefaultReplication() { return (short) replicationFactor.getValue(); } - @Override public void close() throws IOException { - ozoneClient.close(); + proxy.close(); } - @Override public InputStream readFile(String pathStr) throws IOException { incrementCounter(Statistic.OBJECTS_READ, 1); OFSPath ofsPath = new OFSPath(pathStr); @@ -307,7 +306,6 @@ protected void incrementCounter(Statistic objectsRead, long count) { //noop: Use RootedOzoneClientAdapterImpl which supports statistics. } - @Override public OzoneFSOutputStream createFile(String pathStr, short replication, boolean overWrite, boolean recursive) throws IOException { incrementCounter(Statistic.OBJECTS_CREATED, 1); @@ -342,11 +340,6 @@ public OzoneFSOutputStream createFile(String pathStr, short replication, } } - @Override - public void renameKey(String key, String newKeyName) throws IOException { - throw new IOException("OFS doesn't support renameKey, use rename instead."); - } - /** * Rename a path into another. * @@ -358,7 +351,6 @@ public void renameKey(String key, String newKeyName) throws IOException { * @param newPath Target path * @throws IOException */ - @Override public void rename(String path, String newPath) throws IOException { incrementCounter(Statistic.OBJECTS_RENAMED, 1); OFSPath ofsPath = new OFSPath(path); @@ -401,7 +393,6 @@ void rename(OzoneBucket bucket, String path, String newPath) * @param pathStr path to be created as directory * @return true if the key is created, false otherwise */ - @Override public boolean createDirectory(String pathStr) throws IOException { LOG.trace("creating dir for path: {}", pathStr); incrementCounter(Statistic.OBJECTS_CREATED, 1); @@ -412,7 +403,7 @@ public boolean createDirectory(String pathStr) throws IOException { } if (ofsPath.getBucketName().isEmpty()) { // Create volume only - objectStore.createVolume(ofsPath.getVolumeName()); + proxy.createVolume(ofsPath.getVolumeName()); return true; } String keyStr = ofsPath.getKeyName(); @@ -440,7 +431,6 @@ public boolean createDirectory(String pathStr) throws IOException { * @param path path to a key to be deleted * @return true if the key is deleted, false otherwise */ - @Override public boolean deleteObject(String path) { LOG.trace("issuing delete for path to key: {}", path); incrementCounter(Statistic.OBJECTS_DELETED, 1); @@ -486,7 +476,6 @@ private boolean areInSameBucket(List keyNameList) { * @param keyNameList key name list to be deleted * @return true if the key deletion is successful, false otherwise */ - @Override public boolean deleteObjects(List keyNameList) { if (keyNameList.size() == 0) { return true; @@ -540,7 +529,7 @@ public FileStatusAdapter getFileStatus(String path, URI uri, return getFileStatusAdapterForRoot(uri); } if (ofsPath.isVolume()) { - OzoneVolume volume = objectStore.getVolume(ofsPath.getVolumeName()); + OzoneVolume volume = proxy.getVolumeDetails(ofsPath.getVolumeName()); return getFileStatusAdapterForVolume(volume, uri); } try { @@ -615,7 +604,6 @@ public Collection getTrashRoots(boolean allUsers, return ret; } - @Override public Iterator listKeys(String pathStr) throws IOException { incrementCounter(Statistic.OBJECTS_LIST, 1); OFSPath ofsPath = new OFSPath(pathStr); @@ -638,12 +626,11 @@ private List listStatusRoot( URI uri, Path workingDir, String username) throws IOException { OFSPath ofsStartPath = new OFSPath(startPath); - // list volumes - Iterator iter = objectStore.listVolumesByUser( - username, null, ofsStartPath.getVolumeName()); List res = new ArrayList<>(); - while (iter.hasNext() && res.size() < numEntries) { - OzoneVolume volume = iter.next(); + // list volumes + List listVolumes = proxy.listVolumes( + username, null, ofsStartPath.getVolumeName(), (int)numEntries); + for (OzoneVolume volume : listVolumes) { res.add(getFileStatusAdapterForVolume(volume, uri)); if (recursive) { String pathStrNextVolume = volume.getName(); @@ -663,7 +650,7 @@ private List listStatusVolume(String volumeStr, OFSPath ofsStartPath = new OFSPath(startPath); // list buckets in the volume - OzoneVolume volume = objectStore.getVolume(volumeStr); + OzoneVolume volume = proxy.getVolumeDetails(volumeStr); UserGroupInformation ugi = UserGroupInformation.createRemoteUser(volume.getOwner()); String owner = ugi.getShortUserName(); @@ -761,36 +748,36 @@ public List listStatus(String pathStr, boolean recursive, } } - @Override public Token getDelegationToken(String renewer) throws IOException { if (!securityEnabled) { return null; } - Token token = ozoneClient.getObjectStore() - .getDelegationToken(renewer == null ? null : new Text(renewer)); + Token token = proxy.getDelegationToken( + renewer == null ? null : new Text(renewer)); token.setKind(OzoneTokenIdentifier.KIND_NAME); return token; } - public ObjectStore getObjectStore() { - return objectStore; - } - - @Override public KeyProvider getKeyProvider() throws IOException { - return objectStore.getKeyProvider(); + return proxy.getKeyProvider(); } - @Override public URI getKeyProviderUri() throws IOException { - return objectStore.getKeyProviderUri(); + return proxy.getKeyProviderUri(); } - @Override public String getCanonicalServiceName() { - return objectStore.getCanonicalServiceName(); + return proxy.getCanonicalServiceName(); + } + + public OzoneVolume getVolumeDetails(String volumeName) throws IOException { + return proxy.getVolumeDetails(volumeName); + } + + public void deleteVolume(String volumeName) throws IOException { + proxy.deleteVolume(volumeName); } /** diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/OzoneClientAdapter.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/OzoneClientAdapter.java index b9e288164080..d0af188dd78d 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/OzoneClientAdapter.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/OzoneClientAdapter.java @@ -46,9 +46,6 @@ OzoneFSOutputStream createFile(String key, short replication, void renameKey(String key, String newKeyName) throws IOException; - // Users should use rename instead of renameKey in OFS. - void rename(String pathStr, String newPath) throws IOException; - boolean createDirectory(String keyName) throws IOException; boolean deleteObject(String keyName); diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneClientAdapterImpl.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneClientAdapterImpl.java index c5d3f05ec769..eeb9d1f6bddb 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneClientAdapterImpl.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneClientAdapterImpl.java @@ -26,7 +26,7 @@ * Implementation of the RootedOzoneFileSystem calls. */ public class RootedOzoneClientAdapterImpl - extends BasicRootedOzoneClientAdapterImpl { + extends BasicRootedOzoneFileSystemHelper { private OzoneFSStorageStatistics storageStatistics; diff --git a/hadoop-ozone/ozonefs-hadoop3/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneFileSystem.java b/hadoop-ozone/ozonefs-hadoop3/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneFileSystem.java index 6d48ead5ad5f..4d531b62c4c5 100644 --- a/hadoop-ozone/ozonefs-hadoop3/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneFileSystem.java +++ b/hadoop-ozone/ozonefs-hadoop3/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneFileSystem.java @@ -20,7 +20,6 @@ import org.apache.hadoop.hdds.annotation.InterfaceAudience; import org.apache.hadoop.hdds.annotation.InterfaceStability; -import org.apache.hadoop.hdds.conf.ConfigurationSource; import org.apache.hadoop.crypto.key.KeyProvider; import org.apache.hadoop.crypto.key.KeyProviderTokenIssuer; import org.apache.hadoop.fs.FileSystem; @@ -51,12 +50,12 @@ public RootedOzoneFileSystem() { @Override public KeyProvider getKeyProvider() throws IOException { - return getAdapter().getKeyProvider(); + return getHelper().getKeyProvider(); } @Override public URI getKeyProviderUri() throws IOException { - return getAdapter().getKeyProviderUri(); + return getHelper().getKeyProviderUri(); } @Override @@ -85,11 +84,4 @@ protected void incrementCounter(Statistic statistic, long count) { storageStatistics.incrementCounter(statistic, count); } } - - @Override - protected OzoneClientAdapter createAdapter(ConfigurationSource conf, - String omHost, int omPort) throws IOException { - return new RootedOzoneClientAdapterImpl(omHost, omPort, conf, - storageStatistics); - } } diff --git a/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneFileSystem.java b/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneFileSystem.java index 6d48ead5ad5f..4d531b62c4c5 100644 --- a/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneFileSystem.java +++ b/hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/RootedOzoneFileSystem.java @@ -20,7 +20,6 @@ import org.apache.hadoop.hdds.annotation.InterfaceAudience; import org.apache.hadoop.hdds.annotation.InterfaceStability; -import org.apache.hadoop.hdds.conf.ConfigurationSource; import org.apache.hadoop.crypto.key.KeyProvider; import org.apache.hadoop.crypto.key.KeyProviderTokenIssuer; import org.apache.hadoop.fs.FileSystem; @@ -51,12 +50,12 @@ public RootedOzoneFileSystem() { @Override public KeyProvider getKeyProvider() throws IOException { - return getAdapter().getKeyProvider(); + return getHelper().getKeyProvider(); } @Override public URI getKeyProviderUri() throws IOException { - return getAdapter().getKeyProviderUri(); + return getHelper().getKeyProviderUri(); } @Override @@ -85,11 +84,4 @@ protected void incrementCounter(Statistic statistic, long count) { storageStatistics.incrementCounter(statistic, count); } } - - @Override - protected OzoneClientAdapter createAdapter(ConfigurationSource conf, - String omHost, int omPort) throws IOException { - return new RootedOzoneClientAdapterImpl(omHost, omPort, conf, - storageStatistics); - } }